don't add usercss vars to empty sections

This commit is contained in:
tophf 2017-11-26 04:52:14 +03:00
parent fb3554a351
commit 0e518bddcb

View File

@ -1,4 +1,4 @@
/* global loadScript mozParser semverCompare colorParser */ /* global loadScript mozParser semverCompare colorParser styleCodeEmpty */
'use strict'; 'use strict';
// eslint-disable-next-line no-var // eslint-disable-next-line no-var
@ -30,11 +30,12 @@ var usercss = (() => {
':root {\n' + ':root {\n' +
Object.keys(vars).map(k => ` --${k}: ${vars[k].value};\n`).join('') + Object.keys(vars).map(k => ` --${k}: ${vars[k].value};\n`).join('') +
'}\n'; '}\n';
for (const section of sections) { for (const section of sections) {
if (!styleCodeEmpty(section.code)) {
section.code = varDef + section.code; section.code = varDef + section.code;
} }
} }
}
}, },
stylus: { stylus: {
preprocess(source, vars) { preprocess(source, vars) {