import { watch } from "fs"; import { transform } from "lightningcss"; const INPUT = "src/styles/main.css"; const OUTPUT = "public/assets/main.css"; async function build() { const source = Bun.file(INPUT); const { code } = transform({ filename: INPUT, code: await source.bytes(), minify: true, sourceMap: false, }); await Bun.write(OUTPUT, code); console.log(`[css] built ${code.length} bytes`); } await build(); if (process.argv.includes("--watch")) { watch(INPUT, async () => { try { await build(); } catch (e) { console.error("[css]", e); } }); console.log(`[css] watching ${INPUT}`); }