Files
FixIt/layouts/_partials/base/head/css.html
T
Cell 2c0b48370b feat(gen-docs): add Hugo partials docs generation (#809)
* feat(gen-docs): add documentation generation package with SassDoc and TypeDoc support

Add new `@hugo-fixit/gen-docs` package that parses Hugo config (hugo.toml) and generates
documentation. Includes SassDoc annotations for SCSS variables and mixins, TypeDoc config
for TypeScript source docs, and a `.sassdocrc` configuration file.

* docs(readme): add browsers support section

* feat(gen-docs): add Hugo partials docs generation and fix config empty sections

- Add partial-parser.ts: parses Hugo partial comment blocks (@param/@return/@example)
- Add partials.ts renderer: generates grouped Markdown with param tables
- Add `partials` subcommand with -t/-o options for template injection
- Fix config-parser: empty TOML sections (library.js/library.css) now retain descriptions
- Fix config-parser: correctly distinguish section-level vs key-level comments
- Update README with partials subcommand documentation
2026-07-21 12:19:07 +08:00

62 lines
1.8 KiB
HTML

{{- /*
CSS Partial - Base and page-specific CSS loading
Loads the main stylesheet (every page) and conditionally loads
page-specific CSS based on .Kind, .Layout, and .RelPermalink.
Called from: `base/head/index.html`
*/ -}}
{{- $scssVars := partialCached "function/scss-vars.html" . -}}
{{- $fingerprint := .Site.Store.Get "fingerprint" -}}
{{- /* UnoCSS utility classes (pre-built) */ -}}
{{- dict "Source" "css/unocss.css" "Minify" hugo.IsProduction "Fingerprint" $fingerprint | partial "plugin/style.html" -}}
{{- /* Main CSS */ -}}
{{- $mainCSS := dict
"Resource" (resources.Get "scss/main.scss")
"ToCSS" (dict "vars" $scssVars)
"Fingerprint" $fingerprint
| partial "function/to-css.html"
-}}
{{- .Site.Store.Set "mainCSS" $mainCSS -}}
{{- dict "Resource" $mainCSS | partial "plugin/style.html" -}}
{{- /* Page-specific CSS */ -}}
{{- $pageName := "" -}}
{{- $kindsMap := dict
"section" "archives"
"taxonomy" "archives"
"term" "archives"
"home" (
cond (in .RelPermalink "archives") "archives" (
cond (in .RelPermalink "link") "link" (
cond (in .RelPermalink "offline") "" "home"
)
)
)
"page" (
cond (in (slice "search" "friends") .Layout) .Layout (
cond (eq .Type "posts") "posts" ""
)
)
-}}
{{- with (index $kindsMap .Kind) -}}
{{- $pageName = . -}}
{{- end -}}
{{- with $pageName -}}
{{- dict
"Content" (printf `@use "pages/%s";` .)
"Path" (printf "scss/%s.scss" .)
"ToCSS" (dict "vars" $scssVars "targetPath" (printf "css/pages/%s.css" .))
"Fingerprint" $fingerprint
| partial "plugin/style.html"
-}}
{{- end -}}
{{- /* Custom CSS (highest priority) */ -}}
{{- with resources.Get "scss/custom.scss" -}}
{{- dict "Source" "scss/custom.scss" "ToCSS" (dict "vars" $scssVars) "Fingerprint" $fingerprint | partial "plugin/style.html" -}}
{{- end -}}