Skip to content

pantoken / formats/scss/src / toScss

Function: toScss()

toScss(tokens, options?): string

Experimental

Emit SCSS variables for a token IR.

Parameters

tokens

readonly Token[]

The IR (e.g. from @pantoken/tokens).

options?

ToScssOptions = {}

ToScssOptions.

Returns

string

The SCSS source string.

Examples

Emit the default (light) variables

ts
import { toScss } from "@pantoken/scss";
import { tokens } from "@pantoken/tokens";

toScss(tokens); // "$instui-color-brand: #0374b5;\n…"

Resolve the dark mode of another theme

ts
import { toScss } from "@pantoken/scss";
import { byTheme } from "@pantoken/tokens";

toScss(byTheme("canvas"), { mode: "dark" });