-
Notifications
You must be signed in to change notification settings - Fork 57
/
build_css.ts
54 lines (49 loc) · 1.75 KB
/
build_css.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import $ from "jsr:@david/[email protected]";
import browserslist from "npm:[email protected]";
import { browserslistToTargets, transform } from "npm:lightningcss";
const browsers = browserslist(">= 0.5%, not dead");
const styles =
await $`deno run -A npm:[email protected] --input src/html/templates/styles.css`
.text();
const stylesWrapped = ".ddoc {" + styles + "}";
const stylesFinal = transform({
filename: "./styles.css",
code: new TextEncoder().encode(stylesWrapped),
minify: true,
targets: browserslistToTargets(browsers),
analyzeDependencies: false,
});
await Deno.writeFile("src/html/templates/styles.gen.css", stylesFinal.code);
const page =
await $`deno run -A npm:[email protected] --config=./src/html/templates/pages/tailwind.config.ts --input src/html/templates/pages/page.css`
.bytes();
const pageFinal = transform({
filename: "./page.css",
code: page,
minify: true,
targets: browserslistToTargets(browsers),
analyzeDependencies: false,
});
await Deno.writeFile("src/html/templates/pages/page.gen.css", pageFinal.code);
const reset =
await $`deno run -A npm:[email protected] --input src/html/templates/pages/reset.css`
.bytes();
const resetFinal = transform({
filename: "./reset.css",
code: reset,
minify: true,
targets: browserslistToTargets(browsers),
analyzeDependencies: false,
});
await Deno.writeFile("src/html/templates/pages/reset.gen.css", resetFinal.code);
const comrak =
await $`deno run -A npm:[email protected] --input src/html/templates/comrak.css`
.bytes();
const comrakFinal = transform({
filename: "./comrak.css",
code: comrak,
minify: true,
targets: browserslistToTargets(browsers),
analyzeDependencies: false,
});
await Deno.writeFile("src/html/templates/comrak.gen.css", comrakFinal.code);