Skip to content

pantoken / formats/scss/src / toScss

函式: toScss()

toScss(tokens, options?): string

實驗性

為 token IR 輸出 SCSS 變數。

參數

tokens

唯讀 Token[]

IR(例如來自 @pantoken/tokens)。

options?

ToScssOptions = {}

ToScssOptions.

回傳

string

SCSS 原始字串。

範例

輸出預設(淺色)變數

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

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

解析另一個主題的深色模式

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

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