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 = {
default: {
postprocess(sections, vars) {
const varDef =
':root {\n' +
Object.keys(vars).map(k => ` --${k}: ${vars[k].value};\n`).join('') +
'}\n';
let varDef = Object.keys(vars).map(k => ` --${k}: ${vars[k].value};\n`).join('');
if (!varDef) return;
varDef = ':root {\n' + varDef + '}\n';
for (const section of sections) {
if (!styleCodeEmpty(section.code)) {
section.code = varDef + section.code;