Make images smaller using best-in-class codecs, right in the browser.
JavaScript
Instead of replacing empty rules with comments, remove them.
Jason Millere9d91ab0f278
diff --git a/config/critters-webpack-plugin.js b/config/critters-webpack-plugin.jsindex 13a452c6..6e853b53 100644--- a/config/critters-webpack-plugin.js+++ b/config/critters-webpack-plugin.js@@ -126,25 +126,14 @@ module.exports = class CrittersWebpackPlugin {sel = sel.replace(/::?(?:[a-z-]+)([.[#~&^:*]|\s|\n|$)/gi, '$1');return document.querySelector(sel, document) != null;});- // If there are no matched selectors, replace the rule with a comment.+ // If there are no matched selectors, remove the rule:if (rule.selectors.length===0) {- rule.type = 'comment';- rule.comment = '';- delete rule.selectors;- delete rule.declarations;+ return false;}}- if (rule.rules) {- // Filter out comments- rule.rules = rule.rules.filter(notComment);- // If there are no remaining rules, replace the parent rule with a comment.- if (rule.rules.length===0) {- rule.type = 'comment';- rule.comment = '';- delete rule.rules;- }- }+ // If there are no remaining rules, remove the whole rule.+ return !rule.rules || rule.rules.length!==0;});sheet = css.stringify(ast, { compress: this.options.compress!==false });