Move all the root styles to fragment files

Create assets/styles/root to hold all the fragments of the root
stylesheet. This should make it easier to find and hack on style. Yay!
This commit is contained in:
Eryn Wells 2023-05-19 17:05:49 -07:00
parent 273c380fe6
commit 8029f97f9c
16 changed files with 692 additions and 665 deletions

View file

@ -4,20 +4,20 @@
<body>
{{ block "body" . -}}
{{ block "before" . }}{{ end }}
{{ block "header" . }}{{ partial "header.html" .}}{{ end }}
<main class="{{ .Type }} {{ .Kind }}{{ if gt (len .Pages) 0 }} list{{ end }}">
{{ block "main" . }}{{ end }}
</main>
{{- block "footer" . -}}
{{ partial "footer.html" . }}
{{- end -}}
{{- block "before" . -}}{{- end -}}
{{- block "header" . -}}{{ partial "header.html" .}}{{- end -}}
<main class="{{ .Type }} {{ .Kind }}{{ if gt (len .Pages) 0 }} list{{ end }}">
{{ block "main" . }}{{ end }}
</main>
{{- block "footer" . -}}
{{ partial "footer.html" . }}
{{- end -}}
{{- end -}}
{{- partial "development/page_info.html" . -}}
</body>
{{ with partial "resources/root_css.html" . -}}
<link rel="stylesheet" as="style" href="{{ .RelPermalink }}">
{{ range . }}<link rel="stylesheet" as="style" href="{{ .Permalink }}">{{ end }}
{{- end -}}
{{- with partial "resources/section_css.html" . -}}
<link rel="stylesheet" as="style" href="{{ .RelPermalink }}">

View file

@ -1,11 +1,21 @@
{{ $allStylesheets := slice (resources.Get "styles/root.css")
(resources.Get "styles/railroad.css")
(resources.Get "styles/monokai.css") }}
(resources.Get "styles/monokai.css")
| append (resources.Match "styles/root/*.css" | sort) }}
{{ if not hugo.IsProduction }}
{{ $allStylesheets = $allStylesheets | append (resources.Get "styles/development.css") }}
{{ end }}
{{ $rootCSS := $allStylesheets
| resources.Concat "styles/root.css"
| resources.ExecuteAsTemplate "styles/root.css" .
| fingerprint "md5" }}
{{ return $rootCSS }}
{{ $rootStylesheets := slice }}
{{ if hugo.IsProduction }}
{{ $rootStylesheets = $allStylesheets
| resources.ExecuteAsTemplate "styles/root.css" .
| resources.Concat "styles/root.css"
| minify | fingerprint "md5" }}
{{ else }}
{{ range $allStylesheets }}
{{ $rootStylesheets = $rootStylesheets | append (. | resources.ExecuteAsTemplate .Name .) }}
{{ end }}
{{ end }}
{{ return $rootStylesheets }}