forked from denoland/deno_doc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_css.ts
30 lines (27 loc) · 1.04 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
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);