Skip to content

pantoken-root / formats/less/src / toLess

Função: toLess() ​

toLess(tokens, options?): string

Experimental

Emitir variáveis Less para um IR de tokens.

Parâmetros ​

tokens ​

somente leitura Token[]

O IR (por exemplo, de @pantoken/tokens).

options? ​

ToLessOptions = {}

ToLessOptions.

Retorna ​

string

A string de origem Less.

Exemplos ​

Emitir as variáveis padrão (light)

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

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

Resolver o modo escuro de outro tema

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

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