diff options
Diffstat (limited to 'vhosts/blog/nuldoc-src/components/StaticScript.tsx')
| -rw-r--r-- | vhosts/blog/nuldoc-src/components/StaticScript.tsx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/vhosts/blog/nuldoc-src/components/StaticScript.tsx b/vhosts/blog/nuldoc-src/components/StaticScript.tsx new file mode 100644 index 00000000..eb26ada7 --- /dev/null +++ b/vhosts/blog/nuldoc-src/components/StaticScript.tsx @@ -0,0 +1,17 @@ +import { join } from "std/path/mod.ts"; +import { Config } from "../config.ts"; +import { calculateFileHash } from "./utils.ts"; + +export default async function StaticScript( + { fileName, type, config }: { + fileName: string; + type?: string; + config: Config; + }, +) { + const filePath = join(Deno.cwd(), config.locations.staticDir, fileName); + const hash = await calculateFileHash(filePath); + return ( + <script src={`${fileName}?h=${hash}`} {...(type ? { type } : {})}></script> + ); +} |
