From d3b96eb9d8e719e84d8cd39f0dd67d4129ded348 Mon Sep 17 00:00:00 2001 From: liangweiwen Date: Tue, 12 Jun 2018 14:15:10 +0800 Subject: [PATCH] fix: #207 copy code from https://github.com/vuejs/component-compiler-utils/blob/master/lib/stylePlugins/scoped.ts#L70 just find out keyframes name from values array --- lib/style-compiler/plugins/scope-id.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/style-compiler/plugins/scope-id.js b/lib/style-compiler/plugins/scope-id.js index ca33328..f3aa8e9 100644 --- a/lib/style-compiler/plugins/scope-id.js +++ b/lib/style-compiler/plugins/scope-id.js @@ -72,10 +72,11 @@ module.exports = postcss.plugin('add-id', function (opts) { if (/-?animation$/.test(decl.prop)) { decl.value = decl.value.split(',') .map(v => { - var vals = v.split(/\s+/) - var name = vals[0] - if (keyframes[name]) { - return [keyframes[name]].concat(vals.slice(1)).join(' ') + var vals = v.trim().split(/\s+/) + var i = vals.findIndex(val => keyframes[val]) + if (i !== -1) { + vals.splice(i, 1, keyframes[vals[i]]) + return vals.join(' ') } else { return v }