pantoken / packages/plugin-kit/src / extendPlugin
Function: extendPlugin()
extendPlugin(
base,overrides):PantokenPlugin
Beta
Build a plugin on top of another. Same-stage hooks are composed: tokens runs base then overrides (which sees base's output); css merges both CssContributions; icons/native run both; rehype chains resolvers (overrides first). Capabilities are the union.
Parameters
base
The plugin to extend.
overrides
Partial<PantokenPlugin>
Hooks (and an optional name) layered on top.
Returns
A new branded plugin.
Example
Add an extra CSS contribution on top of a base plugin
ts
import { definePlugin, extendPlugin } from "@pantoken/plugin-kit";
const base = definePlugin({ name: "brand", css: () => ({ append: ":root {}" }) });
const themed = extendPlugin(base, { css: () => ({ append: ".dark {}" }) });
// themed.css merges both contributions; its append holds ":root {}\n\n.dark {}"