Skip to content

Commit e07ac33

Browse files
committed
fix single animation name
1 parent 8948f1c commit e07ac33

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,15 @@ module.exports = postcss.plugin('add-id', function (opts) {
3232
})
3333

3434
// If keyframes are found in this <style>, find and rewrite animation names
35-
// in declarations
36-
//
37-
// TODO: the keyframes tracking needs to be across multiple <style> tags
38-
// that belongs to the same component...
35+
// in declarations.
36+
// Caveat: this only works for keyframes and animation rules in the same
37+
// <style> element.
3938
if (Object.keys(keyframes).length) {
4039
root.walkDecls(decl => {
4140
// individual animation-name declaration
4241
if (/-?animation-name$/.test(decl.prop)) {
4342
decl.value = decl.value.split(',')
44-
.map(v => keyframes[v.trim()])
45-
.filter(v => v)
43+
.map(v => keyframes[v.trim()] || v.trim())
4644
.join(',')
4745
}
4846
// shorthand

0 commit comments

Comments
 (0)