UNPKG

metamorphosis

Version:

A css variable management library that helps create and organize variables into easily configurable themes.

16 lines (15 loc) 517 B
import fs from "fs/promises"; import url from "url"; import "@alanscodelog/utils/keys"; import "@alanscodelog/utils/isBlank"; async function writeTheme(theme, metaUrl, filepath) { const location = url.fileURLToPath(new URL(filepath, metaUrl)); const css = Object.entries(theme.css).map(([key, val]) => `${key}: ${val};`).join("\n"); const content = `/* Auto generated by metamorphisis Theme.write. For autocomplete purposes only. */ ${css} `; await fs.writeFile(location, content); } export { writeTheme };