Skip to content

Commit

Permalink
fix: use more strict regex for matching css animation rules
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 24, 2018
1 parent f2fd8b9 commit 4644727
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/stylePlugins/scoped.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ export default postcss.plugin('add-id', (options: any) => (root: Root) => {
if (Object.keys(keyframes).length) {
root.walkDecls(decl => {
// individual animation-name declaration
if (/-?animation-name$/.test(decl.prop)) {
if (/^(-\w+-)?animation-name$/.test(decl.prop)) {
decl.value = decl.value.split(',')
.map(v => keyframes[v.trim()] || v.trim())
.join(',')
}
// shorthand
if (/-?animation$/.test(decl.prop)) {
if (/^(-\w+-)?animation$/.test(decl.prop)) {
decl.value = decl.value.split(',')
.map(v => {
const vals = v.trim().split(/\s+/)
Expand Down

0 comments on commit 4644727

Please sign in to comment.