This repository was archived by the owner on Aug 16, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +67
-8
lines changed
src/style-compiler/plugins Expand file tree Collapse file tree 2 files changed +67
-8
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ module.exports = postcss.plugin('add-id', function (opts) {
20
20
}
21
21
node . selector = selectorParser ( function ( selectors ) {
22
22
selectors . each ( function ( selector ) {
23
- var node = null
23
+ let node = null
24
24
selector . each ( function ( n ) {
25
25
// ">>>" combinator
26
26
if ( n . type === 'combinator' && n . value === '>>>' ) {
@@ -30,9 +30,9 @@ module.exports = postcss.plugin('add-id', function (opts) {
30
30
}
31
31
// /deep/ alias for >>>, since >>> doesn't work in SASS
32
32
if ( n . type === 'tag' && n . value === '/deep/' ) {
33
- var next = n . next ( )
34
- if ( next . type === 'combinator' && next . value === ' ' ) {
35
- next . remove ( )
33
+ const prev = n . prev ( )
34
+ if ( prev . type === 'combinator' && prev . value === ' ' ) {
35
+ prev . remove ( )
36
36
}
37
37
n . remove ( )
38
38
return false
@@ -64,10 +64,12 @@ module.exports = postcss.plugin('add-id', function (opts) {
64
64
if ( / - ? a n i m a t i o n $ / . test ( decl . prop ) ) {
65
65
decl . value = decl . value . split ( ',' )
66
66
. map ( v => {
67
- var vals = v . split ( / \s + / )
68
- var name = vals [ 0 ]
69
- if ( keyframes [ name ] ) {
70
- return [ keyframes [ name ] ] . concat ( vals . slice ( 1 ) ) . join ( ' ' )
67
+ const vals = v . trim ( ) . split ( / \s + / )
68
+ const i = vals . findIndex ( val => keyframes [ val ] )
69
+ if ( i !== - 1 ) {
70
+ vals . splice ( i , 1 , keyframes [ vals [ i ] ] )
71
+
72
+ return vals . join ( ' ' )
71
73
} else {
72
74
return v
73
75
}
Original file line number Diff line number Diff line change
1
+ <style scoped>
2
+ .test {
3
+ color : red ;
4
+ }
5
+ .test :after {
6
+ content : ' bye!' ;
7
+ }
8
+ h1 {
9
+ color : green ;
10
+ }
11
+ .anim {
12
+ animation : color 5s infinite , other 5s ;
13
+ }
14
+ .anim-2 {
15
+ animation-name : color ;
16
+ animation-duration : 5s ;
17
+ }
18
+ .anim-3 {
19
+ animation : 5s color infinite , 5s other;
20
+ }
21
+ .anim-multiple {
22
+ animation : color 5s infinite , opacity 2s ;
23
+ }
24
+ .anim-multiple-2 {
25
+ animation-name : color , opacity;
26
+ animation-duration : 5s , 2s ;
27
+ }
28
+
29
+ @keyframes color {
30
+ from { color : red ; }
31
+ to { color : green ; }
32
+ }
33
+ @-webkit-keyframes color {
34
+ from { color : red ; }
35
+ to { color : green ; }
36
+ }
37
+ @keyframes opacity {
38
+ from { opacity : 0 ; }
39
+ to { opacity : 1 ; }
40
+ }
41
+ @-webkit-keyframes opacity {
42
+ from { opacity : 0 ; }
43
+ to { opacity : 1 ; }
44
+ }
45
+ .foo p >>> .bar {
46
+ color : red ;
47
+ }
48
+ </style >
49
+
50
+ <template >
51
+ <div >
52
+ <div ><h1 >hi</h1 ></div >
53
+ <p class =" abc def" >hi</p >
54
+ <template v-if =" ! ok " ><p class =" test" id =" test" >Hello</p ></template >
55
+ <svg ><template ><p ></p ></template ></svg >
56
+ </div >
57
+ </template >
You can’t perform that action at this time.
0 commit comments