@@ -44,38 +44,31 @@ CSSVariablesCollectorPlugin.prototype = {
4444
4545 toLessVariables ( varsOverride ) {
4646 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
5752 } ;
5853 } ) ;
5954 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 ;
6357 lessVariables += `@${ variableName } : ${ variableValue } ;\n` ;
6458 } ) ;
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 ;
6861 lessVariables += `@${ variableName } : ${ variableValue } ;\n` ;
6962 } ) ;
7063 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` ;
7467 }
7568 } ) ;
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` ;
7972 }
8073 } ) ;
8174 lessVariables += "}\n" ;
0 commit comments