forked from denoland/deno_doc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_css.ts
42 lines (38 loc) · 1.4 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
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: "./page.css",
code: reset,
minify: true,
targets: browserslistToTargets(browsers),
analyzeDependencies: false,
});
await Deno.writeFile("src/html/templates/pages/reset.gen.css", resetFinal.code);