Add CSS injection code
This commit is contained in:
parent
d4dbed85e9
commit
e9a5521dfc
@ -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 */
|
||||
|
Reference in New Issue
Block a user