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

Commit ff28f2f

Browse files
committed
Don’t add important to keyframe declarations
1 parent a899135 commit ff28f2f

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

src/lib/expandApplyAtRules.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,15 @@ function expandApplyAtRules(context) {
119119
let root = postcss.root({ nodes: [node.clone()] })
120120
let canRewriteSelector = node.type !== 'atrule' || (node.type === 'atrule' && node.name !== 'keyframes');
121121

122-
root.walkRules((rule) => {
123-
if (canRewriteSelector) {
122+
if (canRewriteSelector) {
123+
root.walkRules((rule) => {
124124
rule.selector = replaceSelector(apply.parent.selector, rule.selector, applyCandidate)
125-
}
126125

127-
rule.walkDecls((d) => {
128-
d.important = important
126+
rule.walkDecls((d) => {
127+
d.important = important
128+
})
129129
})
130-
})
130+
}
131131

132132
siblings.push([meta, root.nodes[0]])
133133
}

tests/10-apply.test.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,3 +273,11 @@
273273
.foo {
274274
animation: spin 1s linear infinite;
275275
}
276+
@keyframes pulse {
277+
50% {
278+
opacity: 0.5;
279+
}
280+
}
281+
.bar {
282+
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite !important;
283+
}

tests/10-apply.test.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@
3333
<div class="use-with-other-properties-base use-with-other-properties-component"></div>
3434
<div class="a b"></div>
3535
<div class="foo"></div>
36+
<div class="bar"></div>
3637
</body>
3738
</html>

tests/10-apply.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ test('@apply', () => {
109109
.foo {
110110
@apply animate-spin;
111111
}
112+
113+
.bar {
114+
@apply animate-pulse !important;
115+
}
112116
}
113117
`
114118

0 commit comments

Comments
 (0)