Skip to content

pantoken / packages/plugin-kit/src / definePlugin

Fonksyon: definePlugin()

definePlugin(config): PantokenPlugin

Beta

Kreye yon plugin pantoken soti nan hooks li yo. Rezilta a se yon PantokenPlugin nòmal make ak kapasite yo devine soti nan hooks ou te bay yo.

Paramèt

config

PantokenPlugin

Plugin name plis nenpòt nan hooks tokens/icons/css/rehype/native.

Retounen

PantokenPlugin

Yon PantokenPlugin mak.

Egzanp

Yon plugin inifye 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"]