Fix: use .map to build vars

This commit is contained in:
eight 2017-09-12 20:24:25 +08:00
parent 9069562587
commit e3c3dcc1ff

View File

@ -12,11 +12,10 @@ var usercss = (function () {
const BUILDER = {
default: {
postprocess(sections, vars) {
let varDef = ':root {\n';
for (const key of Object.keys(vars)) {
varDef += ` --${key}: ${vars[key].value};\n`;
}
varDef += '}\n';
let varDef =
':root {\n' +
Object.keys(vars).map(k => ` --${k}: ${vars[k].value};\n`).join('') +
'}\n';
for (const section of sections) {
section.code = varDef + section.code;