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')
3
3
4
4
module . exports = postcss . plugin ( 'add-id' , function ( opts ) {
5
5
return function ( root ) {
6
- var keyframes = Object . create ( null )
7
-
8
6
root . each ( function rewriteSelector ( node ) {
9
7
if ( ! node . selector ) {
10
8
// 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 )
18
11
}
19
12
return
20
13
}
@@ -30,13 +23,5 @@ module.exports = postcss.plugin('add-id', function (opts) {
30
23
} )
31
24
} ) . process ( node . selector ) . result
32
25
} )
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
- }
41
26
}
42
27
} )
Original file line number Diff line number Diff line change 8
8
h1 {
9
9
color : green ;
10
10
}
11
- .anim {
12
- animation : color ;
13
- }
14
- @keyframes color {
15
- from { color : red ; }
16
- to { color : green ; }
17
- }
18
11
</style >
19
12
20
13
<template >
Original file line number Diff line number Diff line change @@ -193,12 +193,9 @@ describe('vue-loader', function () {
193
193
194
194
var style = window . document . querySelector ( 'style' ) . textContent
195
195
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}' )
202
199
done ( )
203
200
} )
204
201
} )
You can’t perform that action at this time.
0 commit comments