Skip to content

pantoken-root / formats/less/src / toLess

Fungsi: toLess() ​

toLess(tokens, options?): string

Eksperimental

Hasilkan pemboleh ubah Less untuk IR token.

Parameter ​

tokens ​

hanya-baca Token[]

IR (contohnya daripada @pantoken/tokens).

options? ​

ToLessOptions = {}

ToLessOptions.

Mengembalikan ​

string

String sumber Less.

Contoh ​

Hasilkan pemboleh ubah lalai (ringan)

ts
import { toLess } from "@pantoken/less";
import { tokens } from "@pantoken/tokens";

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

Menyelesaikan mod gelap untuk tema lain

ts
import { toLess } from "@pantoken/less";
import { byTheme } from "@pantoken/tokens";

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