MCPcopy Index your code
hub / github.com/purifycss/purifycss / removeEmptyRules

Method removeEmptyRules

src/CssTreeWalker.js:37–58  ·  view source on GitHub ↗
(rules)

Source from the content-addressed store, hash-verified

35 }
36
37 removeEmptyRules(rules) {
38 let emptyRules = []
39
40 for (let rule of rules) {
41 const ruleType = rule.type
42
43 if (ruleType === RULE_TYPE && rule.selectors.length === 0) {
44 emptyRules.push(rule)
45 }
46 if (ruleType === MEDIA_TYPE) {
47 this.removeEmptyRules(rule.rules)
48 if (rule.rules.length === 0) {
49 emptyRules.push(rule)
50 }
51 }
52 }
53
54 emptyRules.forEach(emptyRule => {
55 const index = rules.indexOf(emptyRule)
56 rules.splice(index, 1)
57 })
58 }
59
60 toString() {
61 if (this.ast) {

Callers 3

readPluginMethod · 0.95
purifycss.jsFile · 0.80
purifycss.es.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected