Skip to content

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

Függvény: simpleIcons()

simpleIcons(options?): PantokenPlugin

Béta

A Simple Icons bővítmény létrehozása.

Paraméterek

options?

SimpleIconsOptions = {}

SimpleIconsOptions. Adjon át egy registry-et, hogy elkerülje a lusta importálást (például token-stage használatban, ahol a horogok szinkronok).

Visszatérés

PantokenPlugin

Egy PantokenPlugin tokens és rehype horogokkal.

Példák

Márka szimbólumok kibocsátása <image> tokenként

ts
import { buildTokens } from "@pantoken/core";
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: kódok feloldása rendereléskor (rehype réteg)

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