Skip to content

Commit 38faa1d

Browse files
committed
[INTERNAL] Minor changes based on code review
1 parent 59a73a8 commit 38faa1d

File tree

2 files changed

+16
-23
lines changed

2 files changed

+16
-23
lines changed

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Builder.prototype.build = function(options) {
143143
customFs: this.customFs
144144
});
145145

146-
async function addInlineParameters(result) {
146+
function addInlineParameters(result) {
147147
return themingParametersDataUri.addInlineParameters({result, options});
148148
}
149149

lib/plugin/css-variables-collector.js

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)