Skip to content

fix scoped id if keyframes has prefix #934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/style-compiler/plugins/scope-id.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = postcss.plugin('add-id', function (opts) {
if (node.type === 'atrule') {
if (node.name === 'media' || node.name === 'supports') {
node.each(rewriteSelector)
} else if (node.name === 'keyframes') {
} else if (/-?keyframes$/.test(node.name)) {
// register keyframes
keyframes[node.params] = node.params = node.params + '-' + opts.id
}
Expand Down
4 changes: 4 additions & 0 deletions test/fixtures/scoped-css.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ h1 {
from { color: red; }
to { color: green; }
}
@-webkit-keyframes color {
from { color: red; }
to { color: green; }
}
.foo p >>> .bar {
color: red;
}
Expand Down
1 change: 1 addition & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ describe('vue-loader', function () {
expect(style).to.contain(`.anim[${id}] {\n animation: color-${id} 5s infinite, other 5s;`)
expect(style).to.contain(`.anim-2[${id}] {\n animation-name: color-${id}`)
expect(style).to.contain(`@keyframes color-${id} {`)
expect(style).to.contain(`@-webkit-keyframes color-${id} {`)
// >>> combinator
expect(style).to.contain(`.foo p[${id}] .bar {\n color: red;\n}`)
done()
Expand Down