Skip to content
This repository was archived by the owner on Apr 6, 2021. It is now read-only.

Commit 217b1ed

Browse files
committed
Don't store options on actual PostCSS node
1 parent 697b244 commit 217b1ed

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/lib/generateRules.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@ function applyVariant(variant, matches, { variantMap }) {
3737
let [variantSort, applyThisVariant] = variantMap.get(variant)
3838
let result = []
3939

40-
for (let [{ sort, layer }, rule] of matches) {
41-
let options = rule.__tailwind ?? {}
42-
40+
for (let [{ sort, layer, options }, rule] of matches) {
4341
if (options.respectVariants === false) {
44-
result.push([{ sort, layer }, rule])
42+
result.push([{ sort, layer, options }, rule])
4543
continue
4644
}
4745

@@ -53,7 +51,7 @@ function applyVariant(variant, matches, { variantMap }) {
5351
continue
5452
}
5553

56-
let withOffset = [{ sort: variantSort | sort, layer }, container.nodes[0]]
54+
let withOffset = [{ sort: variantSort | sort, layer, options }, container.nodes[0]]
5755
result.push(withOffset)
5856
}
5957

@@ -115,16 +113,20 @@ function generateRules(tailwindConfig, candidates, context) {
115113
for (let [sort, plugin] of plugins) {
116114
if (typeof plugin === 'function') {
117115
for (let result of plugin(modifier, pluginHelpers)) {
116+
let options = {}
118117
if (Array.isArray(result)) {
118+
;[, , options = {}] = result
119119
result = toPostCssNode(result, context.postCssNodeCache)
120120
}
121-
matches.push([sort, result])
121+
matches.push([{ ...sort, options }, result])
122122
}
123123
} else {
124+
let options = {}
124125
if (Array.isArray(plugin)) {
126+
;[, , options = {}] = plugin
125127
plugin = toPostCssNode(plugin, context.postCssNodeCache)
126128
}
127-
matches.push([sort, plugin])
129+
matches.push([{ ...sort, options }, plugin])
128130
}
129131
}
130132

src/lib/utils.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function toPostCssNode(rule, postCssNodeCache) {
1111
return postCssNodeCache.get(rule)
1212
}
1313

14-
let [selector, childRule, options = {}] = rule
14+
let [selector, childRule] = rule
1515
let node
1616

1717
if (selector[0] === '@') {
@@ -48,10 +48,6 @@ function toPostCssNode(rule, postCssNodeCache) {
4848
})
4949
}
5050

51-
if (options.respectVariants === false) {
52-
node.__tailwind = Object.assign({}, node.__tailwind, { respectVariants: false })
53-
}
54-
5551
postCssNodeCache.set(rule, node)
5652

5753
return node

0 commit comments

Comments
 (0)