You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
parttimejob/node_modules/clean-css/lib/optimizer/level-1/value-optimizers/url-whitespace.js

23 lines
520 B

4 weeks ago
var startsAsUrl = require('./starts-as-url');
var WHITESPACE_PATTERN = /\\?\n|\\?\r\n/g;
var WHITESPACE_PREFIX_PATTERN = /(\()\s+/g;
var WHITESPACE_SUFFIX_PATTERN = /\s+(\))/g;
var plugin = {
level1: {
value: function urlWhitespace(_name, value) {
if (!startsAsUrl(value)) {
return value;
}
return value
.replace(WHITESPACE_PATTERN, '')
.replace(WHITESPACE_PREFIX_PATTERN, '$1')
.replace(WHITESPACE_SUFFIX_PATTERN, '$1');
}
}
};
module.exports = plugin;