« get me outta code hell

content: generateStaticURLStyleTag: use generateStyleTag - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-05-27 18:48:22 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-05-27 18:48:22 -0300
commit792548d5115e65b97b161781f325adfe268f8a28 (patch)
tree4076c872e404669ca814df2ecc8c8ec8174e9346
parenta70dcd3a002131668a5d5eed8774930ef606d129 (diff)
content: generateStaticURLStyleTag: use generateStyleTag
-rw-r--r--src/content/dependencies/generateStaticURLStyleTag.js26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/content/dependencies/generateStaticURLStyleTag.js b/src/content/dependencies/generateStaticURLStyleTag.js
index 276b0e34..b927e5d6 100644
--- a/src/content/dependencies/generateStaticURLStyleTag.js
+++ b/src/content/dependencies/generateStaticURLStyleTag.js
@@ -1,9 +1,23 @@
 export default {
-  extraDependencies: ['html', 'to'],
+  contentDependencies: ['generateStyleTag'],
+  extraDependencies: ['to'],
 
-  generate: ({html, to}) =>
-    html.tag('style', {class: 'static-url-style'},
-      `.image-media-link::after {\n` +
-      `    mask-image: url("${to('staticMisc.path', 'image.svg')}");\n` +
-      `}`),
+  relations: (relation) => ({
+    styleTag:
+      relation('generateStyleTag'),
+  }),
+
+  generate: (relations, {to}) =>
+    relations.styleTag.slots({
+      attributes: {class: 'static-url-style'},
+
+      rules: [
+        {
+          select: '.image-media-link::after',
+          declare: [
+            `mask-image: url("${to('staticMisc.path', 'image.svg')}");`
+          ],
+        },
+      ],
+    }),
 };