pantoken / packages/core/src / runIconPlugins
Function: runIconPlugins()
runIconPlugins(
tokens,plugins):Token[]
Beta
Run every plugin's icons hook, letting plugins register extra glyphs as <image> tokens. Each hook gets an add (collects entries) and a resolve (looks up the current icon set). The result is de-duplicated by name.
Parameters
tokens
Token[]
plugins
readonly PantokenPlugin[]
Returns
Token[]
Example
Register an extra glyph as an <image> token
ts
import { runIconPlugins, type PantokenPlugin } from "@pantoken/core";
import type { Token } from "@pantoken/model";
const base: Token[] = [];
const star: PantokenPlugin = {
name: "star",
icons: ({ add }) => add({ name: "star", path: "M12 2l3 7h7l-6 4 2 7-6-4-6 4 2-7-6-4h7z" }),
};
const tokens = runIconPlugins(base, [star]);
// → adds a --instui-icon-star token whose value is a data-URI SVG