blob: eb26ada796f83a27be3a9a4c195f1e6316e130e3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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>
);
}
|