@@ -39,7 +39,7 @@ const tailwindApplyPlaceholder = selectorParser.attribute({
39
39
attribute : '__TAILWIND-APPLY-PLACEHOLDER__' ,
40
40
} )
41
41
42
- function generateRulesFromApply ( { rule, utilityName : className , classPosition } , replaceWith ) {
42
+ function generateRulesFromApply ( { rule, utilityName : className , classPosition } , replaceWiths ) {
43
43
const parser = selectorParser ( selectors => {
44
44
let i = 0
45
45
selectors . walkClasses ( c => {
@@ -49,11 +49,13 @@ function generateRulesFromApply({ rule, utilityName: className, classPosition },
49
49
} )
50
50
} )
51
51
52
- const processedSelectors = rule . selectors . map ( selector => {
52
+ const processedSelectors = _ . flatMap ( rule . selectors , selector => {
53
53
// You could argue we should make this replacement at the AST level, but if we believe
54
54
// the placeholder string is safe from collisions then it is safe to do this is a simple
55
55
// string replacement, and much, much faster.
56
- return parser . processSync ( selector ) . replace ( '[__TAILWIND-APPLY-PLACEHOLDER__]' , replaceWith )
56
+ return replaceWiths . map ( replaceWith =>
57
+ parser . processSync ( selector ) . replace ( '[__TAILWIND-APPLY-PLACEHOLDER__]' , replaceWith )
58
+ )
57
59
} )
58
60
59
61
const cloned = rule . clone ( )
@@ -242,7 +244,7 @@ function processApplyAtRules(css, lookupTree, config) {
242
244
// Get new rules with the utility portion of the selector replaced with the new selector
243
245
const rulesToInsert = [
244
246
...applys . map ( applyUtility => {
245
- return generateRulesFromApply ( applyUtility , rule . selector )
247
+ return generateRulesFromApply ( applyUtility , rule . selectors )
246
248
} ) ,
247
249
afterRule ,
248
250
]
0 commit comments