-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate-css.ts
More file actions
24 lines (20 loc) · 764 Bytes
/
generate-css.ts
File metadata and controls
24 lines (20 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/**
* This script demonstrates programmatic generation.
* For most workflows, prefer the CLI.
*/
import { writeFile } from "node:fs/promises";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import type { CSSForgeConfig } from "../../packages/cssforge/src/config.ts";
import { generateCSS } from "../../packages/cssforge/src/mod.ts";
import config from "./cssforge.config.ts";
async function writeCSS(
config: Partial<CSSForgeConfig>,
outputPath: string,
): Promise<void> {
const css = generateCSS(config);
await writeFile(outputPath, css, "utf8");
}
const currentFilePathname = fileURLToPath(import.meta.url);
const currentDir = dirname(currentFilePathname);
writeCSS(config, join(currentDir, "cssforge.css"));