1.0.0 • Published 7 years ago

postcss-prefix-url v1.0.0

Weekly downloads
165
License
ISC
Repository
github
Last release
7 years ago

postcss-prefix-url

PostCSS plugin to prefix your urls

Installation

npm i postcss-prefix-url

or

yarn add postcss-prefix-url

Options

OptionTypeDescription
prefixArray or StringThe strings or string to prefix your url paths with
useUrl = falseBooleanIf set to TRUE then the url()'s will also be prefixed, otherwise ignores them
excludeRegexExclude url paths matching this regex

Examples

Input

body {
  background: cdn('/test.png');
}

.testAbsolute {
  background: cdn(http://absolute.com/test1.png); /* Ignore absolute urls */
}

.withUrl {
  background: url(/testUrl.png);
}

.testExclude {
  background: cdn(/exclude-this/test1.png); /* Exclude this url */
}

Output

body {
  background: url(https://img1.example.com/test.png);
}

.testAbsolute {
  background: url(http://absolute.com/test1.png);
}

.withUrl {
  background: url(https://img1.example.com/testUrl.png);
}

.testExclude {
  background: url(/exclude-this/test1.png);
}