Skip to content

pantoken / formats/less/src / toLess

ฟังก์ชัน: toLess()

toLess(tokens, options?): string

ทดลอง

สร้างตัวแปร Less สำหรับ token IR.

พารามิเตอร์

tokens

อ่านอย่างเดียว Token[]

IR (เช่น จาก @pantoken/tokens)

options?

ToLessOptions = {}

ToLessOptions.

คืนค่า

string

สตริงซอร์สของ Less.

ตัวอย่าง

ส่งออกตัวแปรเริ่มต้น (โหมดสว่าง)

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

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

ระบุโหมดมืดของธีมอื่น

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

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