Skip to content

pantoken-root / formats/less/src / toLess

Funktion: toLess() ​

toLess(tokens, options?): string

Experimentell

Less-Variablen für ein Token-IR ausgeben.

Parameter ​

tokens ​

schreibgeschützt Token[]

Das IR (z. B. von @pantoken/tokens).

options? ​

ToLessOptions = {}

ToLessOptions.

Rückgabe ​

string

Die Less-Quellzeichenfolge.

Beispiele ​

Standard-(helle) Variablen ausgeben

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

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

Löse den Dunkelmodus eines anderen Themas auf

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

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