Skip to content

pantoken / formats/less/src / toLess

Hàm: toLess()

toLess(tokens, options?): string

Thử nghiệm

Xuất các biến Less cho IR của token.

Tham số

tokens

chỉ đọc Token[]

IR (ví dụ: từ @pantoken/tokens).

options?

ToLessOptions = {}

ToLessOptions.

Trả về

string

Chuỗi nguồn Less.

Các ví dụ

Xuất các biến mặc định (sáng)

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

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

Giải quyết chế độ tối của chủ đề khác

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

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