Skip to content

Commit bbbe18d

Browse files
committed
don't localize rules in keyframes
1 parent 6d1d11d commit bbbe18d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ module.exports = postcss.plugin('postcss-modules-local-by-default', function (op
214214
}
215215
});
216216
css.eachRule(function(rule) {
217+
if(rule.parent.type === "atrule" && /keyframes$/.test(rule.parent.name)) {
218+
// ignore keyframe rules
219+
return;
220+
}
217221
var selector = Tokenizer.parse(rule.selector);
218222
var context = {
219223
options: options,

test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ var tests = [
222222
},
223223
{
224224
should: 'localize explicit keyframes',
225-
input: '@keyframes :local(foo) { 0% { color: red; } 100% { color: blue; } } @-webkit-keyframes :global(bar) { from { color: red; } to { color: blue; } }',
226-
expected: '@keyframes :local(foo) { 0% { color: red; } 100% { color: blue; } } @-webkit-keyframes bar { from { color: red; } to { color: blue; } }'
225+
input: '@keyframes :local(foo) { 0% { color: red; } 33.3% { color: yellow; } 100% { color: blue; } } @-webkit-keyframes :global(bar) { from { color: red; } to { color: blue; } }',
226+
expected: '@keyframes :local(foo) { 0% { color: red; } 33.3% { color: yellow; } 100% { color: blue; } } @-webkit-keyframes bar { from { color: red; } to { color: blue; } }'
227227
},
228228
{
229229
should: 'ignore :export statements',

0 commit comments

Comments
 (0)