Skip to content

pantoken-root / packages/plugin-kit/src / definePlugin

Functie: definePlugin() ​

definePlugin(config): PantokenPlugin

Bèta

Maak een pantoken-plugin uit zijn hooks. Het resultaat is een normale PantokenPlugin die is gebrandmerkt met de mogelijkheden die uit de door jou geleverde hooks worden afgeleid.

Parameters ​

config ​

PantokenPlugin

De plugin name plus elk van de hooks tokens/icons/css/rehype/native.

Retourneert ​

PantokenPlugin

Een gebrandmerkte PantokenPlugin.

Voorbeeld ​

Een gecombineerde tokens- en 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"]