Skip to content

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

Fungsi: simpleIcons()

simpleIcons(options?): PantokenPlugin

Beta

Buat plugin Simple Icons.

Parameter

options?

SimpleIconsOptions = {}

SimpleIconsOptions. Berikan sebuah registry untuk menghindari impor malas (mis. dalam penggunaan token-stage, di mana hooks bersifat sinkron).

Mengembalikan

PantokenPlugin

Sebuah PantokenPlugin dengan hooks tokens dan rehype.

Contoh

Keluarkan glyph merek sebagai <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

Mengurai kode :brand: saat 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" }