@@ -44,38 +44,31 @@ CSSVariablesCollectorPlugin.prototype = {
44
44
45
45
toLessVariables ( varsOverride ) {
46
46
const vars = { } ;
47
- Object . keys ( this . vars ) . forEach ( ( key ) => {
48
- const override = this . vars [ key ] . updateAfterEval && varsOverride [ key ] !== undefined ;
49
- /*
50
- if (override) {
51
- console.log(`Override variable "${key}" from "${this.vars[key].css}" to "${varsOverride[key]}"`);
52
- }
53
- */
54
- vars [ key ] = {
55
- css : override ? varsOverride [ key ] : this . vars [ key ] . css ,
56
- export : this . vars [ key ] . export
47
+ Object . keys ( this . vars ) . forEach ( ( variableName ) => {
48
+ const override = this . vars [ variableName ] . updateAfterEval && varsOverride [ variableName ] !== undefined ;
49
+ vars [ variableName ] = {
50
+ css : override ? varsOverride [ variableName ] : this . vars [ variableName ] . css ,
51
+ export : this . vars [ variableName ] . export
57
52
} ;
58
53
} ) ;
59
54
let lessVariables = "" ;
60
- Object . keys ( vars ) . forEach ( ( value , index ) => {
61
- const variableName = value ;
62
- const variableValue = vars [ value ] . css ;
55
+ Object . keys ( vars ) . forEach ( ( variableName ) => {
56
+ const variableValue = vars [ variableName ] . css ;
63
57
lessVariables += `@${ variableName } : ${ variableValue } ;\n` ;
64
58
} ) ;
65
- Object . keys ( this . calcVars ) . forEach ( ( value , index ) => {
66
- const variableName = value ;
67
- const variableValue = this . calcVars [ value ] . css ;
59
+ Object . keys ( this . calcVars ) . forEach ( ( variableName ) => {
60
+ const variableValue = this . calcVars [ variableName ] . css ;
68
61
lessVariables += `@${ variableName } : ${ variableValue } ;\n` ;
69
62
} ) ;
70
63
lessVariables += "\n:root {\n" ;
71
- Object . keys ( vars ) . forEach ( ( value , index ) => {
72
- if ( vars [ value ] . export ) {
73
- lessVariables += `--${ value } : @${ value } ;\n` ;
64
+ Object . keys ( vars ) . forEach ( ( variableName ) => {
65
+ if ( vars [ variableName ] . export ) {
66
+ lessVariables += `--${ variableName } : @${ variableName } ;\n` ;
74
67
}
75
68
} ) ;
76
- Object . keys ( this . calcVars ) . forEach ( ( value , index ) => {
77
- if ( this . calcVars [ value ] . export ) {
78
- lessVariables += `--${ value } : @${ value } ;\n` ;
69
+ Object . keys ( this . calcVars ) . forEach ( ( variableName ) => {
70
+ if ( this . calcVars [ variableName ] . export ) {
71
+ lessVariables += `--${ variableName } : @${ variableName } ;\n` ;
79
72
}
80
73
} ) ;
81
74
lessVariables += "}\n" ;
0 commit comments