Skip to content

Commit

Permalink
improve performance
Browse files Browse the repository at this point in the history
  • Loading branch information
romainmenke committed Sep 17, 2023
1 parent 0d6496e commit f859bd4
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,12 +458,12 @@ class Processor {
* Check for grid/flexbox options.
*/
disabledDecl(node, result) {
if (this.gridStatus(node, result) === false && node.type === 'decl') {
if (node.type === 'decl' && this.gridStatus(node, result) === false) {
if (node.prop.includes('grid') || node.prop === 'justify-items') {
return true
}
}
if (this.prefixes.options.flexbox === false && node.type === 'decl') {
if (node.type === 'decl' && this.prefixes.options.flexbox === false) {
let other = ['order', 'justify-content', 'align-items', 'align-content']
if (node.prop.includes('flex') || other.includes(node.prop)) {
return true
Expand Down Expand Up @@ -641,15 +641,16 @@ class Processor {
})

// Selectors
for (let checker of this.prefixes.remove.selectors) {
css.walkRules((rule, i) => {
css.walkRules((rule, i) => {
if (this.disabled(rule, result)) return

for (let checker of this.prefixes.remove.selectors) {
if (checker.check(rule)) {
if (!this.disabled(rule, result)) {
rule.parent.removeChild(i)
}
rule.parent.removeChild(i)
return
}
})
}
}
})

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

0 comments on commit f859bd4

Please sign in to comment.