From 4fd426627198ae071788eb00b0dc1c1fbc0dfd8e Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 27 Jan 2021 21:43:18 -0400 Subject: refactor theme strings and stick em at top of html --- upd8.js | 39 +++++++++++++-------------------------- 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/upd8.js b/upd8.js index 3eeefbb..1f12fa7 100644 --- a/upd8.js +++ b/upd8.js @@ -1441,6 +1441,7 @@ function img({ async function writePage(directoryParts, { title = '', meta = {}, + theme = '', stylesheet = '', // missing properties are auto-filled, see below! @@ -1453,12 +1454,7 @@ async function writePage(directoryParts, { }) { body.style ??= ''; - if (!body.style.includes('color')) { - if (body.style) { - body.style += '; '; - } - body.style += getThemeString(wikiInfo); - } + theme = theme ?? getThemeString(wikiInfo); main.classes ??= []; main.content ??= ''; @@ -1611,6 +1607,11 @@ async function writePage(directoryParts, { ${Object.entries(meta).filter(([ key, value ]) => value).map(([ key, value ]) => ``).join('\n')} ${canonical && ``} + ${stylesheet && fixWS`