@pantoken/hugo 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # @pantoken/hugo
2
+
3
+ Emit the Instructure token stylesheet for a Hugo site. Hugo has no standard theming-variable
4
+ contract, so this delivers the tokens as drop-in assets under `assets/`, where Hugo Pipes (and Dart
5
+ Sass) pick them up.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm i @pantoken/hugo
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ import { toHugoAssets } from "@pantoken/hugo";
17
+
18
+ for (const { path, content } of toHugoAssets()) {
19
+ /* write `path` under your site root */
20
+ }
21
+ ```
22
+
23
+ Or via the CLI, straight into a site:
24
+
25
+ ```sh
26
+ pantoken generate hugo --out ./my-site
27
+ ```
28
+
29
+ ## Output
30
+
31
+ Three files under the site root:
32
+
33
+ - `assets/scss/_pantoken.scss` — a Sass partial (`$instui-*` variables). Import it from your main
34
+ SCSS and compile with `resources.Get "scss/main.scss" | toCSS`.
35
+ - `assets/css/pantoken.css` — a plain stylesheet (`--instui-*` custom properties) you can pipe
36
+ directly with `resources.Get "css/pantoken.css"`.
37
+ - `assets/css/pantoken-prose.css` — an InstUI-look stylesheet for rendered content (tables,
38
+ headings, links, code) in a `.pantoken-prose` region. From `@pantoken/components`.
39
+
40
+ Use the Sass partial if your site compiles SCSS; use the plain CSS otherwise. Add the prose sheet
41
+ and wrap your content in `.pantoken-prose` for the InstUI content look.
42
+
43
+ ## API
44
+
45
+ - **`toHugoAssets(): HugoFile[]`** — build the token asset files (paths relative to the site root).
46
+ - **`HugoFile`** — a generated file: `path` (site-relative) and `content`.
47
+
48
+ ## Related
49
+
50
+ - Wraps `@pantoken/scss` (the Sass partial), `@pantoken/css` (the plain stylesheet), and
51
+ `@pantoken/components` (the content look).
52
+ - Mirrors `@pantoken/jekyll`, the same idea for Jekyll sites.
53
+
54
+ ## License
55
+
56
+ MIT
@@ -0,0 +1,28 @@
1
+ //#region src/index.d.ts
2
+ /** A generated file: a site-relative path and its contents. */
3
+ interface HugoFile {
4
+ path: string;
5
+ content: string;
6
+ }
7
+ /**
8
+ * Build the token asset files for a Hugo site (paths relative to the site root).
9
+ *
10
+ * @returns The Sass partial (`assets/scss/_pantoken.scss`), the plain stylesheet
11
+ * (`assets/css/pantoken.css`), and the prose stylesheet (`assets/css/pantoken-prose.css`).
12
+ *
13
+ * @example Write the assets under a site root
14
+ * ```ts
15
+ * import { writeFileSync, mkdirSync } from "node:fs";
16
+ * import { dirname, join } from "node:path";
17
+ * import { toHugoAssets } from "@pantoken/hugo";
18
+ *
19
+ * for (const { path, content } of toHugoAssets()) {
20
+ * const dest = join("./my-site", path);
21
+ * mkdirSync(dirname(dest), { recursive: true });
22
+ * writeFileSync(dest, content);
23
+ * }
24
+ * ```
25
+ */
26
+ declare function toHugoAssets(): HugoFile[];
27
+ //#endregion
28
+ export { HugoFile, toHugoAssets };
package/dist/index.mjs ADDED
@@ -0,0 +1,52 @@
1
+ import { css } from "@pantoken/css";
2
+ import { proseCss } from "@pantoken/components";
3
+ import { scss } from "@pantoken/scss";
4
+ //#region src/index.ts
5
+ /**
6
+ * `@pantoken/hugo` — emit the Instructure token stylesheet for a Hugo site.
7
+ *
8
+ * Hugo has no standard theming-variable contract, so this delivers the tokens as drop-in assets
9
+ * under `assets/` (where Hugo Pipes / Dart Sass pick them up): a Sass partial and a plain CSS file
10
+ * (from `@pantoken/scss` and `@pantoken/css`), plus an InstUI-look prose stylesheet (from
11
+ * `@pantoken/components`) that styles content in a `.pantoken-prose` region.
12
+ *
13
+ * @module
14
+ * @experimental
15
+ */
16
+ /**
17
+ * Build the token asset files for a Hugo site (paths relative to the site root).
18
+ *
19
+ * @returns The Sass partial (`assets/scss/_pantoken.scss`), the plain stylesheet
20
+ * (`assets/css/pantoken.css`), and the prose stylesheet (`assets/css/pantoken-prose.css`).
21
+ *
22
+ * @example Write the assets under a site root
23
+ * ```ts
24
+ * import { writeFileSync, mkdirSync } from "node:fs";
25
+ * import { dirname, join } from "node:path";
26
+ * import { toHugoAssets } from "@pantoken/hugo";
27
+ *
28
+ * for (const { path, content } of toHugoAssets()) {
29
+ * const dest = join("./my-site", path);
30
+ * mkdirSync(dirname(dest), { recursive: true });
31
+ * writeFileSync(dest, content);
32
+ * }
33
+ * ```
34
+ */
35
+ function toHugoAssets() {
36
+ return [
37
+ {
38
+ path: "assets/scss/_pantoken.scss",
39
+ content: scss
40
+ },
41
+ {
42
+ path: "assets/css/pantoken.css",
43
+ content: css
44
+ },
45
+ {
46
+ path: "assets/css/pantoken-prose.css",
47
+ content: proseCss({ scope: ".pantoken-prose" })
48
+ }
49
+ ];
50
+ }
51
+ //#endregion
52
+ export { toHugoAssets };
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@pantoken/hugo",
3
+ "version": "0.1.0",
4
+ "description": "Emit the Instructure token stylesheet for a Hugo site (an assets Sass partial + a plain CSS asset).",
5
+ "license": "MIT",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "type": "module",
10
+ "exports": {
11
+ ".": "./dist/index.mjs",
12
+ "./package.json": "./package.json"
13
+ },
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "dependencies": {
18
+ "@pantoken/css": "0.1.0",
19
+ "@pantoken/components": "0.1.0",
20
+ "@pantoken/scss": "0.1.0"
21
+ },
22
+ "devDependencies": {
23
+ "@types/node": "^24.13.3",
24
+ "typescript": "^6.0.3",
25
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.2.4",
26
+ "vite-plus": "0.2.4"
27
+ },
28
+ "scripts": {
29
+ "build": "vp pack",
30
+ "dev": "vp pack --watch",
31
+ "test": "vp test",
32
+ "check": "vp check"
33
+ }
34
+ }