aboutsummaryrefslogtreecommitdiffhomepage
path: root/services/nuldoc/nuldoc-src/components/StaticStylesheet.ts
diff options
context:
space:
mode:
Diffstat (limited to 'services/nuldoc/nuldoc-src/components/StaticStylesheet.ts')
-rw-r--r--services/nuldoc/nuldoc-src/components/StaticStylesheet.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/services/nuldoc/nuldoc-src/components/StaticStylesheet.ts b/services/nuldoc/nuldoc-src/components/StaticStylesheet.ts
new file mode 100644
index 0000000..43802d2
--- /dev/null
+++ b/services/nuldoc/nuldoc-src/components/StaticStylesheet.ts
@@ -0,0 +1,12 @@
+import { join } from "@std/path";
+import { Config } from "../config.ts";
+import { elem, Element } from "../dom.ts";
+import { calculateFileHash } from "./utils.ts";
+
+export default async function StaticStylesheet(
+ { fileName, config }: { fileName: string; config: Config },
+): Promise<Element> {
+ const filePath = join(Deno.cwd(), config.locations.staticDir, fileName);
+ const hash = await calculateFileHash(filePath);
+ return elem("link", { rel: "stylesheet", href: `${fileName}?h=${hash}` });
+}