Skip to content

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

Funktion: simpleIcons()

simpleIcons(options?): PantokenPlugin

Beta

Skapa Simple Icons-pluginet.

Parametrar

options?

SimpleIconsOptions = {}

SimpleIconsOptions. Skicka en registry för att undvika den lata importen (t.ex. vid användning i token-stage, där hooks är synkrona).

Returnerar

PantokenPlugin

En PantokenPlugin med tokens och rehype hooks.

Exempel

Emitera varumärkesglyfer som <image>-tokens

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

Lös :brand:-koder vid renderering (rehype-lagret)

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" }