Skip to content

Commit

Permalink
fix(optimizer): do not convert colors inside local font names
Browse files Browse the repository at this point in the history
  • Loading branch information
Sirius-A committed Jun 26, 2019
1 parent dc728a8 commit 0f66ccb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/optimizer/level-1/optimize.js
Expand Up @@ -37,8 +37,13 @@ var IMPORT_PREFIX_PATTERN = /^@import/i;
var QUOTED_PATTERN = /^('.*'|".*")$/;
var QUOTED_BUT_SAFE_PATTERN = /^['"][a-zA-Z][a-zA-Z\d\-_]+['"]$/;
var URL_PREFIX_PATTERN = /^url\(/i;
var LOCAL_PREFIX_PATTERN = /^local\(/i;
var VARIABLE_NAME_PATTERN = /^--\S+$/;

function isLocal(value){
return LOCAL_PREFIX_PATTERN.test(value);
}

function isNegative(value) {
return value && value[1][0] == '-' && parseFloat(value[1]) < 0;
}
Expand Down Expand Up @@ -443,7 +448,7 @@ function optimizeBody(rule, properties, context) {
value = !options.compatibility.properties.urlQuotes ?
removeUrlQuotes(value) :
value;
} else if (isQuoted(value)) {
} else if (isQuoted(value) || isLocal(value)) {
value = levelOptions.removeQuotes ?
removeQuotes(name, value) :
value;
Expand Down

0 comments on commit 0f66ccb

Please sign in to comment.