Skip to content
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 @@ -63,7 +63,7 @@ module.exports = postcss.plugin('add-id', ({ id }) => root => {
if (/-?animation$/.test(decl.prop)) {
decl.value = decl.value.split(',')
.map(v => {
const vals = v.split(/\s+/)
const vals = v.trim().split(/\s+/)
const name = vals[0]
if (keyframes[name]) {
return [keyframes[name]].concat(vals.slice(1)).join(' ')
Expand Down
16 changes: 16 additions & 0 deletions test/fixtures/scoped-css.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ h1 {
animation-name: color;
animation-duration: 5s;
}
.anim-multiple {
animation: color 5s infinite, opacity 2s;
}
.anim-multiple-2 {
animation-name: color, opacity;
animation-duration: 5s, 2s;
}

@keyframes color {
from { color: red; }
to { color: green; }
Expand All @@ -23,6 +31,14 @@ h1 {
from { color: red; }
to { color: green; }
}
@keyframes opacity {
from { opacity: 0; }
to { opacity: 1; }
}
@-webkit-keyframes opacity {
from { opacity: 0; }
to { opacity: 1; }
}
.foo p >>> .bar {
color: red;
}
Expand Down
5 changes: 5 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ describe('vue-loader', () => {
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} {`)

expect(style).to.contain(`.anim-multiple[${id}] {\n animation: color-${id} 5s infinite,opacity-${id} 2s;`)
expect(style).to.contain(`.anim-multiple-2[${id}] {\n animation-name: color-${id},opacity-${id};`)
expect(style).to.contain(`@keyframes opacity-${id} {`)
expect(style).to.contain(`@-webkit-keyframes opacity-${id} {`)
// >>> combinator
expect(style).to.contain(`.foo p[${id}] .bar {\n color: red;\n}`)
done()
Expand Down