Skip to content

Commit

Permalink
don't localize rules in keyframes
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Jun 11, 2015
1 parent 6d1d11d commit bbbe18d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ module.exports = postcss.plugin('postcss-modules-local-by-default', function (op
}
});
css.eachRule(function(rule) {
if(rule.parent.type === "atrule" && /keyframes$/.test(rule.parent.name)) {
// ignore keyframe rules
return;
}
var selector = Tokenizer.parse(rule.selector);
var context = {
options: options,
Expand Down
4 changes: 2 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ var tests = [
},
{
should: 'localize explicit keyframes',
input: '@keyframes :local(foo) { 0% { color: red; } 100% { color: blue; } } @-webkit-keyframes :global(bar) { from { color: red; } to { color: blue; } }',
expected: '@keyframes :local(foo) { 0% { color: red; } 100% { color: blue; } } @-webkit-keyframes bar { from { color: red; } to { color: blue; } }'
input: '@keyframes :local(foo) { 0% { color: red; } 33.3% { color: yellow; } 100% { color: blue; } } @-webkit-keyframes :global(bar) { from { color: red; } to { color: blue; } }',
expected: '@keyframes :local(foo) { 0% { color: red; } 33.3% { color: yellow; } 100% { color: blue; } } @-webkit-keyframes bar { from { color: red; } to { color: blue; } }'
},
{
should: 'ignore :export statements',
Expand Down

0 comments on commit bbbe18d

Please sign in to comment.