@terrazzo/plugin-css
v2.0.3
Published
Convert DTCG design tokens JSON into CSS variables for use in any web application or native app with webview.
Downloads
102,213
Maintainers
Readme
⛋ @terrazzo/plugin-css
Convert DTCG tokens into CSS variables for use in any web application or native app with webview. Convert your modes into CSS media queries for complete flexibility.
Setup
Requires Node.js and the CLI installed. With both installed, run:
npm i -D @terrazzo/plugin-cssAdd a terrazzo.config.ts to the root of your project:
import { defineConfig } from "@terrazzo/cli";
import css from "@terrazzo/plugin-css";
export default defineConfig({
outDir: "./tokens/",
plugins: [
css({
filename: "tokens.css",
variableName: (id) => id.replace(/\./g, "-"),
baseSelector: ":root",
}),
],
});Lastly, run:
npx tz buildAnd you’ll see a ./tokens/tokens.css file generated in your project.
