Skip to content

pantoken / formats/icon-font/src / buildIconFont

Hàm: buildIconFont()

buildIconFont(options?): Promise<IconFontResult>

Beta

Xây dựng font biểu tượng.

Tham số

options?

BuildIconFontOptions = {}

BuildIconFontOptions.

Trả về

Promise<IconFontResult>

Kết quả IconFontResult.

Các ví dụ

Xây dựng toàn bộ font và ghi các tệp tạo ra

ts
import { buildIconFont } from "@pantoken/icon-font";
import { writeFileSync } from "node:fs";

const font = await buildIconFont();
writeFileSync("PanTokens.woff2", font.woff2);
writeFileSync("PanTokens.ttf", font.ttf);
writeFileSync("icons.css", font.css);

Tên font tùy chỉnh và một tập con các biểu tượng từ một chủ đề khác

ts
import { buildIconFont } from "@pantoken/icon-font";

const font = await buildIconFont({
  fontName: "Instructure",
  icons: ["arrow-left", "check-mark"],
  theme: "canvas",
});
font.codepoints; // { "arrow-left": "e000", "check-mark": "e001" }