diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-05-27 16:23:35 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-05-27 16:23:35 -0300 |
commit | 97a5454d43cc76692688208dae21be8eece18a31 (patch) | |
tree | c7b2dbdadb97a4247d758cb14e6430a8c73b714f | |
parent | 5c6f167ee213586a94d238098f6b2ee6afe74fe8 (diff) |
content: generatePageLayout: internally process style tags
-rw-r--r-- | src/content/dependencies/generatePageLayout.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/content/dependencies/generatePageLayout.js b/src/content/dependencies/generatePageLayout.js index e0332c8e..59c0be5f 100644 --- a/src/content/dependencies/generatePageLayout.js +++ b/src/content/dependencies/generatePageLayout.js @@ -594,16 +594,23 @@ export default { ])), ]); - const styleRulesCSS = - html.resolve(slots.styleRules, {normalize: 'string'}); + const fakeStyleTags = + slots.styleRules.map(rule => html.tag('style', rule)); + + const styleTagsCSS = + html.smush(/*slots.styleTags*/ fakeStyleTags) + .content + .map(tag => + html.resolve(tag.content, {normalize: 'string'})) + .join('\n\n'); const fallbackWallpaperStyleTag = - (styleRulesCSS.match(/body::before[^}]*background-image:/) + (styleTagsCSS.match(/body::before[^}]*background-image:/) ? '' : relations.wikiWallpaperStyleTag); const numWallpaperParts = - styleRulesCSS + styleTagsCSS .match(/\.wallpaper-part:nth-child/g) ?.length ?? 0; @@ -755,9 +762,7 @@ export default { fallbackWallpaperStyleTag, - html.tag('style', [ - slots.styleRules, - ]), + fakeStyleTags, html.tag('script', { src: to('staticLib.path', 'chroma-js/chroma.min.js'), |