Skip to content

pantoken / packages/plugin-kit/src / definePlugin

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

definePlugin(config): PantokenPlugin

เบต้า

สร้างปลั๊กอิน pantoken จาก hooks ของมัน ผลลัพธ์คือ PantokenPlugin ปกติที่ติดแบรนด์ด้วยความสามารถที่ได้จาก hooks ที่คุณให้มา.

พารามิเตอร์

config

PantokenPlugin

ปลั๊กอิน name พร้อมกับ hook ใดๆ ใน tokens/icons/css/rehype/native.

คืนค่า

PantokenPlugin

เป็น PantokenPlugin ที่มีแบรนด์.

ตัวอย่าง

ปลั๊กอิน tokens + css แบบรวมเป็นหนึ่งเดียว

ts
import { capabilitiesOf, definePlugin } from "@pantoken/plugin-kit";

const brand = definePlugin({
  name: "@acme/brand",
  tokens: (ctx) => [
    ...ctx.tokens,
    ctx.define({ name: "--instui-brand", value: "var(--instui-color-background-brand)" }),
  ],
  css: () => ({ append: ":root { color-scheme: light dark; }" }),
});

capabilitiesOf(brand); // → ["tokens", "css"]