Skip to content

pantoken-root / formats/less/src / toLess

פונקציה: toLess() ​

toLess(tokens, options?): string

ניסיוני

להפיק משתני Less עבור IR של טוקן.

פרמטרים ​

tokens ​

לקריאה בלבד Token[]

ה‑IR (למשל מ־@pantoken/tokens).

options? ​

ToLessOptions = {}

ToLessOptions.

מחזיר ​

string

מחרוזת המקור של Less.

דוגמאות ​

הפק את משתני ברירת המחדל (בהירים)

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

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

פתור את מצב הלילה של ערכת נושא אחרת

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

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