Skip to content

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

פונקציה: simpleIcons()

simpleIcons(options?): PantokenPlugin

בטא

צור את התוסף Simple Icons.

פרמטרים

options?

SimpleIconsOptions = {}

SimpleIconsOptions. העבר registry כדי למנוע את הייבוא האצל (למשל בשימוש ב- token-stage, שבו ה-hooks סינכרוניים).

מחזיר

PantokenPlugin

תוסף PantokenPlugin עם tokens ו-rehype hooks.

דוגמאות

ייצא גליפי מותג כ-<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

פתור קודי :brand: בעת הרינדור (שכבת 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" }