Skip to content

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

Funktion: simpleIcons()

simpleIcons(options?): PantokenPlugin

Beta

Opret Simple Icons pluginen.

Parametre

options?

SimpleIconsOptions = {}

SimpleIconsOptions. Pass en registry for at undgå doven indlæsning (f.eks. i token-stage brug, hvor hooks er synkron).

Returnerer

PantokenPlugin

Et PantokenPlugin med tokens og rehype hooks.

Eksempler

Udsted brand glyphs 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 ved rendering (rehype lag)

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