Fix all the CSS resources templates
This commit is contained in:
parent
da64dd30d5
commit
6740e7b61d
3 changed files with 48 additions and 24 deletions
|
@ -1,11 +1,28 @@
|
|||
{{ $sectionCSS := dict }}
|
||||
{{ $sectionStylesheet := "" }}
|
||||
{{ if .IsHome }}
|
||||
{{ $sectionStylesheet = printf "styles/home.css" }}
|
||||
{{ else }}
|
||||
{{ $sectionStylesheet = printf "styles/%s.css" .Section }}
|
||||
{{ $stylesheetName := printf "styles/%s.css" .Section }}
|
||||
|
||||
{{ $stylesheets := slice }}
|
||||
{{ if gt (len .Section) 0 }}
|
||||
{{ with resources.Match (printf "styles/%s/*" .Section) }}
|
||||
{{ $stylesheets = . }}
|
||||
{{ else }}
|
||||
{{ with resources.Get $stylesheetName }}
|
||||
{{ $stylesheets = (slice .) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ with resources.Get $sectionStylesheet }}
|
||||
{{ $sectionCSS = . | fingerprint "md5" }}
|
||||
|
||||
{{ $sectionStylesheets := slice }}
|
||||
{{ if $stylesheets }}
|
||||
{{ range $stylesheets }}
|
||||
{{ $sectionStylesheets = $sectionStylesheets | append (. | resources.ExecuteAsTemplate .Name .) }}
|
||||
{{ end }}
|
||||
|
||||
{{ if hugo.IsProduction }}
|
||||
{{ $sectionStylesheets = slice ($sectionStylesheets
|
||||
| resources.Concat $stylesheetName
|
||||
| minify
|
||||
| fingerprint "md5") }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ return $sectionCSS }}
|
||||
|
||||
{{ return $sectionStylesheets }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue