Files
FixIt/layouts/_partials/base/head/css.html
T
Cell 47247e01c5 refactor(assets): split SCSS into per-layout CSS bundles (#789)
- Restructure pages/ directory: shared/, posts/, specials/ modules
- Add per-layout entry points (home, posts, archives, search, friends, link)
- Include 404 and offline styles in main bundle
- Consolidate scss-vars.html with Internal and Appearance categories
- Simplify _variables.scss with @forward "hugo:vars"
- Extract CSS loading logic to base/head/css.html
- Update [params.appearance] with all configurable values
2026-06-23 17:19:51 +08:00

52 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" -}}
{{- /* Base CSS (every page) */ -}}
{{- $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 */ -}}
{{- $pageCSSPath := "" -}}
{{- if eq .Kind "home" -}}
{{- if in .RelPermalink "archives" -}}
{{- $pageCSSPath = "scss/archives.scss" -}}
{{- else if in .RelPermalink "link" -}}
{{- $pageCSSPath = "scss/link.scss" -}}
{{- else -}}
{{- $pageCSSPath = "scss/home.scss" -}}
{{- end -}}
{{- else if eq .Kind "page" -}}
{{- if eq .Layout "search" -}}
{{- $pageCSSPath = "scss/search.scss" -}}
{{- else if eq .Layout "friends" -}}
{{- $pageCSSPath = "scss/friends.scss" -}}
{{- else if eq .Type "posts" -}}
{{- $pageCSSPath = "scss/posts.scss" -}}
{{- end -}}
{{- else if in (slice "section" "taxonomy" "term") .Kind -}}
{{- $pageCSSPath = "scss/archives.scss" -}}
{{- end -}}
{{- with $pageCSSPath -}}
{{- dict "Source" . "ToCSS" (dict "vars" $scssVars) "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 -}}