Skip to content

pantoken / formats/scss/src / toScss

Fungsi: toScss()

toScss(tokens, options?): string

Eksperimental

Hasilkan pembolehubah SCSS untuk IR token.

Parameter

tokens

hanya-baca Token[]

IR (contohnya daripada @pantoken/tokens).

options?

ToScssOptions = {}

ToScssOptions.

Mengembalikan

string

Rentetan sumber SCSS.

Contoh

Hasilkan pemboleh ubah lalai (ringan)

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

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

Menyelesaikan mod gelap untuk tema lain

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

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