Skip to content

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

함수: simpleIcons()

simpleIcons(options?): PantokenPlugin

베타

Simple Icons 플러그인을 만듭니다.

매개변수

options?

SimpleIconsOptions = {}

SimpleIconsOptions. 지연 가져오기를 피하려면 registry를 전달하세요 (예: 후크가 동기적인 token-stage 사용에서).

반환값

PantokenPlugin

tokensrehype 훅을 제공하는 PantokenPlugin.

예제들

브랜드 글리프를 <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

렌더링 시(rehype 레이어) :brand: 코드를 해석합니다

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