Skip to content

pantoken / formats/less/src / toLess

Funkcja: toLess()

toLess(tokens, options?): string

Eksperymentalne

Generuj zmienne Less dla tokenów IR.

Parametry

tokens

tylko do odczytu Token[]

IR (np. z @pantoken/tokens).

options?

ToLessOptions = {}

ToLessOptions.

Zwraca

string

Ciąg źródłowy Less.

Przykłady

Generuj domyślne (jasne) zmienne

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

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

Rozwiąż tryb ciemny dla innego motywu

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

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