don't add varDef to code if there are no vars

This commit is contained in:
tophf 2018-07-15 17:55:54 +03:00
parent e60628b51a
commit 165f7b5684

View File

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