Skip to content

Commit 8d244cc

Browse files
committed
dry-up duplication
1 parent 681e4d8 commit 8d244cc

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

src/flagged/applyComplexClasses.js

+4-21
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function buildUtilityMap(css, lookupTree) {
9595
let index = 0
9696
const utilityMap = {}
9797

98-
lookupTree.walkRules(rule => {
98+
function handle(rule) {
9999
const utilityNames = extractUtilityNames(rule.selector)
100100

101101
utilityNames.forEach((utilityName, i) => {
@@ -113,27 +113,10 @@ function buildUtilityMap(css, lookupTree) {
113113
})
114114
index++
115115
})
116-
})
117-
118-
css.walkRules(rule => {
119-
const utilityNames = extractUtilityNames(rule.selector)
120-
121-
utilityNames.forEach((utilityName, i) => {
122-
if (utilityMap[utilityName] === undefined) {
123-
utilityMap[utilityName] = []
124-
}
116+
}
125117

126-
utilityMap[utilityName].push({
127-
index,
128-
utilityName,
129-
classPosition: i,
130-
get rule() {
131-
return cloneRuleWithParent(rule)
132-
},
133-
})
134-
index++
135-
})
136-
})
118+
lookupTree.walkRules(handle)
119+
css.walkRules(handle)
137120

138121
return utilityMap
139122
}

0 commit comments

Comments
 (0)