Teach resources/page_css how to load CSS stylesheets with .Kind
This commit is contained in:
parent
851c74b2c9
commit
c94c4a6c95
1 changed files with 19 additions and 7 deletions
|
@ -1,12 +1,24 @@
|
|||
{{ $stylesheets := slice }}
|
||||
{{ with .Resources.Match "*.css" }}
|
||||
{{ range . }}
|
||||
{{ $stylesheets = $stylesheets | append (. | resources.ExecuteAsTemplate .Name .) }}
|
||||
{{ end }}
|
||||
{{ if hugo.IsProduction }}
|
||||
{{ $stylesheets = slice ($stylesheets
|
||||
| resources.Concat (printf "%s/page.css" $.File.Dir)
|
||||
| fingerprint "md5") }}
|
||||
{{ $stylesheets = $stylesheets | append . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ return $stylesheets }}
|
||||
|
||||
{{ if eq .Kind "home" }}
|
||||
{{ with resources.Get "styles/home.css" }}
|
||||
{{ $stylesheets = $stylesheets | append . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ $processedStylesheets := slice }}
|
||||
{{ range $stylesheets }}
|
||||
{{ $processedStylesheets = $processedStylesheets | append (. | resources.ExecuteAsTemplate .Name .) }}
|
||||
{{ end }}
|
||||
{{ if hugo.IsProduction }}
|
||||
{{ $processedStylesheets = slice ($processedStylesheets
|
||||
| resources.Concat (printf "%s/page.css" $.File.Dir)
|
||||
| fingerprint "md5") }}
|
||||
{{ end }}
|
||||
|
||||
{{ return $processedStylesheets }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue