@@ -17,13 +17,13 @@ export const cssClassRename: PluginGenerator = (dictionary) => ({
17
17
18
18
if ( ! selector ) return ;
19
19
20
- Object . entries ( dictionary ) . forEach ( ( [ from , to ] ) => {
20
+ for ( const [ from , to ] of Object . entries ( dictionary ) ) {
21
21
if ( ! selector . includes ( from ) ) return ;
22
22
23
23
const newSelector = selector . replace ( new RegExp ( from , 'g' ) , to ) ;
24
24
25
25
rule . selector = newSelector ;
26
- } ) ;
26
+ }
27
27
} ,
28
28
} ) ;
29
29
@@ -34,23 +34,21 @@ export const cssVarRename: PluginGenerator = (dictionary) => ({
34
34
35
35
const deleted = new Set < string > ( ) ;
36
36
37
- Object . entries ( dictionary ) . forEach ( ( [ from , to ] ) => {
37
+ for ( const [ from , to ] of Object . entries ( dictionary ) ) {
38
38
if ( ! R . isEmpty ( to ) ) {
39
- switch ( true ) {
40
- case R . includes ( from , value ) :
41
- to === '[delete]' && deleted . add ( deleteMsg ( decl , from ) ) ;
42
- decl . value = value . replace ( from , to ) ;
43
- break ;
44
-
45
- case R . includes ( from , prop ) :
46
- if ( decl . variable ) {
47
- to === '[delete]' && deleted . add ( deleteMsg ( decl , from ) ) ;
48
- decl . prop = prop . replace ( from , to ) ;
49
- break ;
50
- }
39
+ if ( R . includes ( from , value ) ) {
40
+ if ( to === '[delete]' ) {
41
+ deleted . add ( deleteMsg ( decl , from ) ) ;
42
+ }
43
+ decl . value = value . replace ( from , to ) ;
44
+ } else if ( R . includes ( from , prop ) && decl . variable ) {
45
+ if ( to === '[delete]' ) {
46
+ deleted . add ( deleteMsg ( decl , from ) ) ;
47
+ }
48
+ decl . prop = prop . replace ( from , to ) ;
51
49
}
52
50
}
53
- } ) ;
51
+ }
54
52
55
53
if ( deleted . size > 0 ) {
56
54
Array . from ( deleted ) . forEach ( printDelete ) ;
0 commit comments