postcss-normalize-url
Normalize URLs with PostCSS.
Install via npm:
npm install postcss-normalize-url --save
var postcss = require('postcss')
var normalize = require('postcss-normalize-url');
var css = 'h1 { background: url("http://site.com:80/image.jpg") }';
console.log(postcss(normalize()).process(css).css);
// => 'h1 { background: url(http://site.com/image.jpg) }'
Note that this module will also try to normalize relative URLs, and is capable of stripping unnecessary quotes. For more examples, see the tests.
Please see the normalize-url documentation. By default,
normalizeProtocol
and stripFragment
are set to false
.
Pull requests are welcome. If you add functionality, then please add unit tests to cover it.
MIT © Ben Briggs