blob: 0e3ab19439bc31ebd8fb50c42a6c45b8d796e777 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import { join } from "@std/path";
import { Config } from "../config.ts";
import { calculateFileHash } from "./utils.ts";
export default async function StaticScript(
{ fileName, type, defer, config }: {
fileName: string;
type?: string;
defer?: "true";
config: Config;
},
) {
const filePath = join(Deno.cwd(), config.locations.staticDir, fileName);
const hash = await calculateFileHash(filePath);
return (
<script src={`${fileName}?h=${hash}`} type={type} defer={defer}></script>
);
}
|