* Adds `process` method for compatibility with optimize-css-assets-webpack-plugin.
+[4.1.4 / 2017-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v4.1.3...4.1)
+==================
+
+* Fixed issue [#950](https://github.com/jakubpawlowicz/clean-css/issues/950) - bug in removing unused `@font-face` rules.
+
[4.1.3 / 2017-05-18](https://github.com/jakubpawlowicz/clean-css/compare/v4.1.2...v4.1.3)
==================
function removeUnusedAtRule(tokens, matchCallback, markCallback, context) {
var atRules = {};
var atRule;
- var token;
+ var atRuleTokens;
+ var atRuleToken;
var zeroAt;
var i, l;
markUsedAtRules(tokens, markCallback, atRules, context);
for (atRule in atRules) {
- token = atRules[atRule];
- zeroAt = token[0] == Token.AT_RULE ? 1 : 2;
- token[zeroAt] = [];
+ atRuleTokens = atRules[atRule];
+
+ for (i = 0, l = atRuleTokens.length; i < l; i++) {
+ atRuleToken = atRuleTokens[i];
+ zeroAt = atRuleToken[0] == Token.AT_RULE ? 1 : 2;
+ atRuleToken[zeroAt] = [];
+ }
}
}
if (token[0] == Token.AT_RULE_BLOCK && token[1][0][1].indexOf('@counter-style') === 0) {
match = token[1][0][1].split(' ')[1];
- atRules[match] = token;
+ atRules[match] = atRules[match] || [];
+ atRules[match].push(token);
}
}
if (property[1][1] == 'font-family') {
match = property[2][1].toLowerCase();
- atRules[match] = token;
+ atRules[match] = atRules[match] || [];
+ atRules[match].push(token);
break;
}
}
if (token[0] == Token.NESTED_BLOCK && keyframeRegex.test(token[1][0][1])) {
match = token[1][0][1].split(' ')[1];
- atRules[match] = token;
+ atRules[match] = atRules[match] || [];
+ atRules[match].push(token);
}
}
if (token[0] == Token.AT_RULE && token[1].indexOf('@namespace') === 0) {
match = token[1].split(' ')[1];
- atRules[match] = token;
+ atRules[match] = atRules[match] || [];
+ atRules[match].push(token);
}
}
'one used with !important': [
'@font-face{font-family:test}.block{font:16px test!important}',
'@font-face{font-family:test}.block{font:16px test!important}'
+ ],
+ 'one used declaration in another @font-face': [
+ '@font-face{font-family:test;font-weight:normal}@font-face{font-family:test;font-weight:bold}',
+ ''
]
}, { level: { 2: { removeUnusedAtRules: true } } })
)