Skip to content

pantoken / formats/less/src / toLess

Función: toLess()

toLess(tokens, options?): string

Experimental

Emitir variables Less para un IR de tokens.

Parámetros

tokens

solo lectura Token[]

El IR (p. ej. de @pantoken/tokens).

options?

ToLessOptions = {}

ToLessOptions.

Devuelve

string

La cadena fuente de Less.

Ejemplos

Emitir las variables predeterminadas (claro)

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

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

Resolver el modo oscuro de otro tema

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

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