Skip to content

pantoken / packages/core/src / runTokenPlugins

Fonksyon: runTokenPlugins()

runTokenPlugins(tokens, theme, plugins): Token[]

Beta

Kouri chak plugin tokens hook nan lòd. Chak hook resevwa lis aktyèl la epi retounen ranplasman konplè a; rezilta a de-duplike pa non.

Paramèt

tokens

Token[]

theme

Theme

plugins

sèlman pou lekti PantokenPlugin[]

Retounen

Token[]

Egzanp

ts
import { runTokenPlugins, type PantokenPlugin } from "@pantoken/core";
import type { Token } from "@pantoken/model";

const base: Token[] = [
  { name: "--instui-x", syntax: "<color>", inherits: true, value: "#fff" },
];
const addBrand: PantokenPlugin = {
  name: "brand",
  tokens: ({ tokens }) => [
    ...tokens,
    defineToken({ name: "--instui-brand", value: "#0374B5" }),
  ],
};

runTokenPlugins(base, "rebrand", [addBrand]); // → base + the --instui-brand token