Skip to content

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

Functie: simpleIcons()

simpleIcons(options?): PantokenPlugin

Bèta

Maak de Simple Icons-plugin.

Parameters

options?

SimpleIconsOptions = {}

SimpleIconsOptions. Geef een registry door om de lazy import te vermijden (bijv. bij token-stage gebruik, waar hooks synchroon zijn).

Retourneert

PantokenPlugin

Een PantokenPlugin met tokens- en rehype-hooks.

Voorbeelden

Genereer merksymbolen als <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

Los :brand:-codes op tijdens renderen (rehype-laag)

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