Skip to content

Commit 309b8e5

Browse files
RobinMalfaitadamwathan
authored andcommitted
re-use the same tailwindApplyPlaceholder
1 parent e39fd6f commit 309b8e5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/flagged/applyComplexClasses.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@ function hasAtRule(css, atRule) {
2020
return foundAtRule
2121
}
2222

23+
const tailwindApplyPlaceholder = selectorParser.attribute({
24+
attribute: '__TAILWIND-APPLY-PLACEHOLDER__',
25+
})
26+
2327
function generateRulesFromApply({ rule, utilityName: className, classPosition }, replaceWith) {
2428
const processedSelectors = rule.selectors.map(selector => {
2529
const processor = selectorParser(selectors => {
2630
let i = 0
2731
selectors.walkClasses(c => {
28-
if (c.value === className && classPosition === i) {
29-
c.replaceWith(selectorParser.attribute({ attribute: '__TAILWIND-APPLY-PLACEHOLDER__' }))
32+
if (classPosition === i++ && c.value === className) {
33+
c.replaceWith(tailwindApplyPlaceholder)
3034
}
31-
i++
3235
})
3336
})
3437

0 commit comments

Comments
 (0)