From 165f7b56848aebbd28e432e53a20dc9f6f287916 Mon Sep 17 00:00:00 2001 From: tophf Date: Sun, 15 Jul 2018 17:55:54 +0300 Subject: [PATCH] don't add varDef to code if there are no vars --- js/usercss.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/js/usercss.js b/js/usercss.js index 072bbe68..ff3c9c9a 100644 --- a/js/usercss.js +++ b/js/usercss.js @@ -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;