Skip to content

pantoken / formats/less/src / toLess

Functie: toLess()

toLess(tokens, options?): string

Experimenteel

Genereer Less-variabelen voor een token-IR.

Parameters

tokens

alleen-lezen Token[]

De IR (bijvoorbeeld van @pantoken/tokens).

options?

ToLessOptions = {}

ToLessOptions.

Retourneert

string

De Less-bronstring.

Voorbeelden

Genereer de standaard (lichte) variabelen

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

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

Bepaal de donkere modus van een ander thema

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

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