Skip to content

pantoken / packages/core/src / runTokenPlugins

함수: runTokenPlugins()

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

베타

모든 플러그인의 tokens 훅을 순서대로 실행합니다. 각 훅은 현재 목록을 받고 전체 교체값을 반환합니다; 결과는 이름으로 중복 제거됩니다.

매개변수

tokens

Token[]

theme

Theme

plugins

읽기 전용 PantokenPlugin[]

반환값

Token[]

예제

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