Skip to content

Commit 9d2ecc3

Browse files
mpr0xyyyx990803
authored andcommitted
fix scoped id if keyframes has prefix (#934)
* add -webkit-keyframes in test * add scope id if keyframes has prefix * add @-webkit-keyframes in test
1 parent c48e6fe commit 9d2ecc3

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

lib/style-compiler/plugins/scope-id.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = postcss.plugin('add-id', function (opts) {
1111
if (node.type === 'atrule') {
1212
if (node.name === 'media' || node.name === 'supports') {
1313
node.each(rewriteSelector)
14-
} else if (node.name === 'keyframes') {
14+
} else if (/-?keyframes$/.test(node.name)) {
1515
// register keyframes
1616
keyframes[node.params] = node.params = node.params + '-' + opts.id
1717
}

test/fixtures/scoped-css.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ h1 {
1919
from { color: red; }
2020
to { color: green; }
2121
}
22+
@-webkit-keyframes color {
23+
from { color: red; }
24+
to { color: green; }
25+
}
2226
.foo p >>> .bar {
2327
color: red;
2428
}

test/test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ describe('vue-loader', function () {
237237
expect(style).to.contain(`.anim[${id}] {\n animation: color-${id} 5s infinite, other 5s;`)
238238
expect(style).to.contain(`.anim-2[${id}] {\n animation-name: color-${id}`)
239239
expect(style).to.contain(`@keyframes color-${id} {`)
240+
expect(style).to.contain(`@-webkit-keyframes color-${id} {`)
240241
// >>> combinator
241242
expect(style).to.contain(`.foo p[${id}] .bar {\n color: red;\n}`)
242243
done()

0 commit comments

Comments
 (0)