Skip to content

pantoken / formats/less/src / toLess

Funksjon: toLess()

toLess(tokens, options?): string

Eksperimentell

Generer Less-variablar for ein token IR.

Parametrar

tokens

skrivbeskytta Token[]

IR-en (til dømes frå @pantoken/tokens).

options?

ToLessOptions = {}

ToLessOptions.

Returnerer

string

Less-kjeldestrengen.

Døme

Generer standard (lys) variablar

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

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

Løys mørk modus for eit anna tema

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

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