Skip to content

Commit a87f4cd

Browse files
authored
improve performance (#1500)
1 parent 0d6496e commit a87f4cd

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

lib/processor.js

+10-9
Original file line numberDiff line numberDiff line change
@@ -458,12 +458,12 @@ class Processor {
458458
* Check for grid/flexbox options.
459459
*/
460460
disabledDecl(node, result) {
461-
if (this.gridStatus(node, result) === false && node.type === 'decl') {
461+
if (node.type === 'decl' && this.gridStatus(node, result) === false) {
462462
if (node.prop.includes('grid') || node.prop === 'justify-items') {
463463
return true
464464
}
465465
}
466-
if (this.prefixes.options.flexbox === false && node.type === 'decl') {
466+
if (node.type === 'decl' && this.prefixes.options.flexbox === false) {
467467
let other = ['order', 'justify-content', 'align-items', 'align-content']
468468
if (node.prop.includes('flex') || other.includes(node.prop)) {
469469
return true
@@ -641,15 +641,16 @@ class Processor {
641641
})
642642

643643
// Selectors
644-
for (let checker of this.prefixes.remove.selectors) {
645-
css.walkRules((rule, i) => {
644+
css.walkRules((rule, i) => {
645+
if (this.disabled(rule, result)) return
646+
647+
for (let checker of this.prefixes.remove.selectors) {
646648
if (checker.check(rule)) {
647-
if (!this.disabled(rule, result)) {
648-
rule.parent.removeChild(i)
649-
}
649+
rule.parent.removeChild(i)
650+
return
650651
}
651-
})
652-
}
652+
}
653+
})
653654

654655
return css.walkDecls((decl, i) => {
655656
if (this.disabled(decl, result)) return

0 commit comments

Comments
 (0)