Don't propogate apply !important option to non-apply rules (#2376)

* Don't propogate apply !important option to non-apply rules

Fixes #2362.

* Update changelog
This commit is contained in:
Adam Wathan 2020-09-13 09:44:19 -04:00 • committed by GitHub
parent 4e322b2cbd
commit 416fb4d06b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 3 deletions

View file

@ -238,15 +238,13 @@ function processApplyAtRules(css, lookupTree, config) {
: util => util.rule.nodes.forEach(n => afterRule.append(n.clone()))
)
rulesToInsert.push(afterRule)
const { nodes } = _.tap(postcss.root({ nodes: rulesToInsert }), root =>
root.walkDecls(d => {
d.important = important
})
)
const mergedRules = mergeAdjacentRules(nearestParentRule, nodes)
const mergedRules = mergeAdjacentRules(nearestParentRule, [...nodes, afterRule])
applyRule.remove()
parent.after(mergedRules)