Skip to content

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

Funció: simpleIcons()

simpleIcons(options?): PantokenPlugin

Beta

Crea el connector Simple Icons.

Paràmetres

options?

SimpleIconsOptions = {}

SimpleIconsOptions. Passa un registry per evitar la importació tardana (p. ex., en ús de fase de token, on els ganxos són síncrons).

Retorna

PantokenPlugin

Un PantokenPlugin amb ganxos tokens i rehype.

Exemples

Emet glifos de marca com a tokens <image>

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

Resol els codis :brand: en renderitzar (capa 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" }