Skip to content

pantoken / platforms/hugo/src / toHugoAssets

Hàm: toHugoAssets()

toHugoAssets(): HugoFile[]

Thử nghiệm

Xây dựng các tệp tài sản token cho một trang Hugo (đường dẫn tương đối so với thư mục gốc của trang).

Trả về

HugoFile[]

Phần Sass partial (assets/scss/_pantoken.scss), stylesheet thường\n(assets/css/pantoken.css), và stylesheet cho văn bản (assets/css/pantoken-prose.css).

Ví dụ

Ghi các tài sản dưới thư mục gốc của trang

ts
import { writeFileSync, mkdirSync } from "node:fs";
import { dirname, join } from "node:path";
import { toHugoAssets } from "@pantoken/hugo";

for (const { path, content } of toHugoAssets()) {
  const dest = join("./my-site", path);
  mkdirSync(dirname(dest), { recursive: true });
  writeFileSync(dest, content);
}