Skip to content

pantoken / platforms/hugo/src / toHugoAssets

Function: toHugoAssets()

toHugoAssets(): HugoFile[]

Experimental

Build the token asset files for a Hugo site (paths relative to the site root).

Returns

HugoFile[]

The Sass partial (assets/scss/_pantoken.scss), the plain stylesheet (assets/css/pantoken.css), and the prose stylesheet (assets/css/pantoken-prose.css).

Example

Write the assets under a site root

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);
}