Skip to content

Commit 1e9ddc6

Browse files
committed
make sure that importants are applied correctly
1 parent bcb51ec commit 1e9ddc6

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/lib/substituteClassApplyAtRules.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,21 @@ function processApplyAtRules(css, lookupTree, config) {
242242
: (util) => util.rule.nodes.forEach((n) => afterRule.append(n.clone()))
243243
)
244244

245-
const { nodes } = _.tap(postcss.root({ nodes: rulesToInsert }), (root) =>
245+
rulesToInsert.forEach((rule) => {
246+
if (rule.type === 'atrule') {
247+
rule.walkRules((rule) => {
248+
rule.__tailwind = { ...rule.__tailwind, important }
249+
})
250+
} else {
251+
rule.__tailwind = { ...rule.__tailwind, important }
252+
}
253+
})
254+
255+
const { nodes } = _.tap(postcss.root({ nodes: rulesToInsert }), (root) => {
246256
root.walkDecls((d) => {
247257
d.important = important
248258
})
249-
)
259+
})
250260

251261
const mergedRules = mergeAdjacentRules(nearestParentRule, [...nodes, afterRule])
252262

0 commit comments

Comments
 (0)