Skip to content

pantoken / plugins/pantoken/simple-icons/src / simpleIcons

Funktion: simpleIcons()

simpleIcons(options?): PantokenPlugin

Beta

Erstelle das Simple Icons-Plugin.

Parameter

options?

SimpleIconsOptions = {}

SimpleIconsOptions. Übergebe ein registry, um den Lazy-Import zu vermeiden (z. B. bei Verwendung in token-stage, wo Hooks synchron sind).

Rückgabe

PantokenPlugin

Ein PantokenPlugin mit tokens- und rehype-Hooks.

Beispiele

Markenglyphen als <image>-Tokens ausgeben

ts
import { buildTokens } from "@pantoken/core/build";
import { simpleIcons } from "@pantoken/plugin-simple-icons";
import * as registry from "simple-icons";

buildTokens({
  theme: "rebrand",
  plugins: [simpleIcons({ registry, slugs: ["github", "react"] })],
});
// adds --instui-icon-github, --instui-icon-react as <image> tokens

:brand:-Codes beim Rendern auflösen (rehype-Ebene)

ts
import { simpleIcons } from "@pantoken/plugin-simple-icons";
import * as registry from "simple-icons";

const { resolve } = simpleIcons({ registry }).rehype!({ resolve: () => undefined });
resolve("github"); // { name, path, svg, viewBox, source: "simple-icons" }