blob: f2adb473a3ac0e0dc68e56e1280437dfda27f953 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import { join } from "@std/path";
import { Config } from "../config.ts";
import { Element, link } from "../dom.ts";
import { calculateFileHash } from "./utils.ts";
export default async function StaticStylesheet(
{ site, fileName, config }: {
site?: string;
fileName: string;
config: Config;
},
): Promise<Element> {
const filePath = join(
Deno.cwd(),
config.locations.staticDir,
site || "_all",
fileName,
);
const hash = await calculateFileHash(filePath);
return link({ rel: "stylesheet", href: `${fileName}?h=${hash}` });
}
|