@terrazzo/plugin-js
v2.0.0
Published
Use DTCG tokens in Node.js for server-rendered applications.
Maintainers
Readme
⛋ @terrazzo/plugin-js
Use DTCG resolvers in Node.js for server-rendered applications.
[!NOTE]
Since adding support for resolvers, plugin-js has added more weight and metadata than is practical for most clientside uses. You may want to consider using plugin-css-in-js instead.
Setup
Requires Node.js. With that installed, run:
npm i -D @terrazzo/cli @terrazzo/plugin-jsAdd a terrazzo.config.ts to the root of your project with:
import { defineConfig } from "@terrazzo/cli";
import js from "@terrazzo/plugin-js";
export default defineConfig({
outDir: "./tokens/",
plugins: [
js({
filename: "tokens.js", // Note: `.d.ts` is generated too
}),
],
});Lastly, run:
npx tz buildAnd you’ll see a ./tokens/tokens.js file generated in your project.
