Skip to content

pantoken / packages/core/src / runTokenPlugins

Feidhm: runTokenPlugins()

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

Béite

Rith greamaigh tokens gach breiseán i ndiaidh a chéile. Faigheann gach greamaigh an liosta reatha agus filleann sé an ionad iomlán; déantar an toradh a dhíchomhcheangal de réir ainm.

Paraiméadair

tokens

Token[]

theme

Theme

plugins

léamh-amháin PantokenPlugin[]

Tuairisceáin

Token[]

Sampla

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