From e9a5521dfc3d34aba8a9b24e9b135fcae3ab2e3d Mon Sep 17 00:00:00 2001 From: Evan Pratten Date: Fri, 17 Apr 2020 17:20:51 -0400 Subject: [PATCH] Add CSS injection code --- docs/assets/js/injection/cssinjector.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/assets/js/injection/cssinjector.js b/docs/assets/js/injection/cssinjector.js index 5483fa9..22cd1c5 100644 --- a/docs/assets/js/injection/cssinjector.js +++ b/docs/assets/js/injection/cssinjector.js @@ -1,4 +1,6 @@ +// Document root theme +let _rootCSS = document.body.style; /** * Inject all KVPs from a dictionary into the document @@ -9,6 +11,17 @@ */ function injectMultiCSS(prefix, source_dict) { + console.log(`[CSSInjector] Injecting css for: ${prefix}`); + + // Iter through every variable, and add it to the site CSS + Object.keys(source_dict).forEach((k) => { + + let varname = `--${prefix}-${k}`; + + _rootCSS += `${varname}:${source_dict[k]};` + + }); + } /* Mappings from constants file to CSS */