diff options
| author | nsfisis <nsfisis@gmail.com> | 2023-03-20 20:45:21 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2023-03-20 20:45:21 +0900 |
| commit | ab4c36fa056fcf0d1dc1f7c2301630cd88f783fe (patch) | |
| tree | fadcfb0a37cd3ec97f5c8297a5a9f8aafcdc2295 /nuldoc-src/components/page_layout.ts | |
| parent | 899ab9679f6c7a4b9e32b49ada823168b2c9738d (diff) | |
| download | blog.nsfisis.dev-ab4c36fa056fcf0d1dc1f7c2301630cd88f783fe.tar.gz blog.nsfisis.dev-ab4c36fa056fcf0d1dc1f7c2301630cd88f783fe.tar.zst blog.nsfisis.dev-ab4c36fa056fcf0d1dc1f7c2301630cd88f783fe.zip | |
feat(nuldoc): support cache busting for JavaScript files
Diffstat (limited to 'nuldoc-src/components/page_layout.ts')
| -rw-r--r-- | nuldoc-src/components/page_layout.ts | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/nuldoc-src/components/page_layout.ts b/nuldoc-src/components/page_layout.ts index 7dc6a43..50ed45d 100644 --- a/nuldoc-src/components/page_layout.ts +++ b/nuldoc-src/components/page_layout.ts @@ -1,7 +1,6 @@ -import { crypto, toHashString } from "std/crypto/mod.ts"; -import { join } from "std/path/mod.ts"; import { Config } from "../config.ts"; import { el, Element, text } from "../dom.ts"; +import { stylesheetLinkElement } from "./utils.ts"; type Params = { metaCopyrightYear: number; @@ -62,16 +61,6 @@ export async function pageLayout( ); } -async function stylesheetLinkElement( - fileName: string, - config: Config, -): Promise<Element> { - const filePath = join(Deno.cwd(), config.locations.staticDir, fileName); - const content = (await Deno.readFile(filePath)).buffer; - const hash = toHashString(await crypto.subtle.digest("MD5", content), "hex"); - return el("link", [["rel", "stylesheet"], ["href", `${fileName}?h=${hash}`]]); -} - function metaElement(attrs: [string, string][]): Element { return el("meta", attrs); } |
