Skip to content

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

Fungsi: simpleIcons()

simpleIcons(options?): PantokenPlugin

Beta

Buat plugin Simple Icons.

Parameter

options?

SimpleIconsOptions = {}

SimpleIconsOptions. Hantar registry untuk mengelakkan import malas (contohnya dalam penggunaan token-stage, di mana hooks adalah segerak).

Mengembalikan

PantokenPlugin

Satu PantokenPlugin dengan hook tokens dan rehype.

Contoh

Hasilkan glif jenama sebagai <image> token

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

Selesaikan kod :brand: semasa render (lapisan 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" }