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