Replace all @imports
and url()
s using a given function.
$ npm install --save css-url-rewrite
function replace(url) {
return 'http://example.com' + url;
}
var replaced = rewriteCssUrls(css, replace);
body {
background: url(/images/bg.png);
}
yields:
body {
background: url(http://example.com/images/bg.png);
}