File tree Expand file tree Collapse file tree 3 files changed +5
-30
lines changed
lib/style-compiler/plugins Expand file tree Collapse file tree 3 files changed +5
-30
lines changed Original file line number Diff line number Diff line change @@ -3,18 +3,11 @@ var selectorParser = require('postcss-selector-parser')
33
44module . exports = postcss . plugin ( 'add-id' , function ( opts ) {
55 return function ( root ) {
6- var keyframes = Object . create ( null )
7-
86 root . each ( function rewriteSelector ( node ) {
97 if ( ! node . selector ) {
108 // handle media queries
11- if ( node . type === 'atrule' ) {
12- if ( node . name === 'media' ) {
13- node . each ( rewriteSelector )
14- } else if ( node . name === 'keyframes' ) {
15- // register keyframes
16- keyframes [ node . params ] = node . params = node . params + '-' + opts . id
17- }
9+ if ( node . type === 'atrule' && node . name === 'media' ) {
10+ node . each ( rewriteSelector )
1811 }
1912 return
2013 }
@@ -30,13 +23,5 @@ module.exports = postcss.plugin('add-id', function (opts) {
3023 } )
3124 } ) . process ( node . selector ) . result
3225 } )
33-
34- if ( Object . keys ( keyframes ) . length ) {
35- root . walkDecls ( decl => {
36- if ( / - ? a n i m a t i o n $ / . test ( decl . prop ) && keyframes [ decl . value ] ) {
37- decl . value = keyframes [ decl . value ]
38- }
39- } )
40- }
4126 }
4227} )
Original file line number Diff line number Diff line change 88h1 {
99 color : green ;
1010}
11- .anim {
12- animation : color ;
13- }
14- @keyframes color {
15- from { color : red ; }
16- to { color : green ; }
17- }
1811 </style >
1912
2013<template >
Original file line number Diff line number Diff line change @@ -193,12 +193,9 @@ describe('vue-loader', function () {
193193
194194 var style = window . document . querySelector ( 'style' ) . textContent
195195 style = normalizeNewline ( style )
196- expect ( style ) . to . contain ( `.test[${ id } ] {\n color: yellow;\n}` )
197- expect ( style ) . to . contain ( `.test[${ id } ]:after {\n content: \'bye!\';\n}` )
198- expect ( style ) . to . contain ( `h1[${ id } ] {\n color: green;\n}` )
199- // scoped keyframes
200- expect ( style ) . to . contain ( `.anim[${ id } ] {\n animation: color-${ id } ;\n}` )
201- expect ( style ) . to . contain ( `@keyframes color-${ id } {` )
196+ expect ( style ) . to . contain ( '.test[' + id + '] {\n color: yellow;\n}' )
197+ expect ( style ) . to . contain ( '.test[' + id + ']:after {\n content: \'bye!\';\n}' )
198+ expect ( style ) . to . contain ( 'h1[' + id + '] {\n color: green;\n}' )
202199 done ( )
203200 } )
204201 } )
You can’t perform that action at this time.
0 commit comments