Skip to content

pantoken / packages/plugin-kit/src / definePlugin

Funktion: definePlugin()

definePlugin(config): PantokenPlugin

Beta

Opret en pantoken-plugin ud fra sine hooks. Resultatet er et normalt PantokenPlugin mærket med muligheder udledt fra de hooks, du gav.

Parametre

config

PantokenPlugin

Plugin'et name plus nogen af tokens/icons/css/rehype/native hooks.

Returnerer

PantokenPlugin

Et mærket PantokenPlugin.

Eksempel

Et samlet tokens + css-plugin

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"]