Skip to content

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

Funkcja: simpleIcons()

simpleIcons(options?): PantokenPlugin

Beta

Utwórz wtyczkę Simple Icons.

Parametry

options?

SimpleIconsOptions = {}

SimpleIconsOptions. Przekaż registry, aby uniknąć importu leniwego (np. w użyciu na etapie token-stage, gdzie hooki są synchroniczne).

Zwraca

PantokenPlugin

Plugin PantokenPlugin z hookami tokens i rehype.

Przykłady

Emituj glify marki jako <image> tokeny

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

Rozwiązuj kody :brand: podczas renderowania (warstwa rehype)

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