my-idlers/node_modules/clean-css/lib/optimizer/level-1/value-optimizers/url-prefix.js
cp6 fd22b0bf58 V2 (Laravel re-make)
V2 (Laravel re-make)
2022-03-06 02:02:12 +11:00

24 lines
512 B
JavaScript
Vendored

var startsAsUrl = require('./starts-as-url');
var OptimizationLevel = require('../../../options/optimization-level').OptimizationLevel;
var URL_PREFIX_PATTERN = /^url\(/i;
var plugin = {
level1: {
value: function urlPrefix(_name, value, options) {
if (!options.level[OptimizationLevel.One].normalizeUrls) {
return value;
}
if (!startsAsUrl(value)) {
return value;
}
return value.replace(URL_PREFIX_PATTERN, 'url(');
}
}
};
module.exports = plugin;