In the page_css partial, check array length and presence of $.File before concatenating stylesheets
This commit is contained in:
parent
a4a0561bc8
commit
ee98566283
1 changed files with 15 additions and 3 deletions
|
@ -15,10 +15,22 @@
|
||||||
{{ range $stylesheets }}
|
{{ range $stylesheets }}
|
||||||
{{ $processedStylesheets = $processedStylesheets | append (. | resources.ExecuteAsTemplate .Name .) }}
|
{{ $processedStylesheets = $processedStylesheets | append (. | resources.ExecuteAsTemplate .Name .) }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if hugo.IsProduction }}
|
{{ if hugo.IsProduction }}
|
||||||
{{ $processedStylesheets = slice ($processedStylesheets
|
{{/*
|
||||||
| resources.Concat (printf "%s/page.css" $.File.Dir)
|
Replace the list of stylesheets that helps with debugging with a
|
||||||
| fingerprint "md5") }}
|
concatenated and fingerprinted version.
|
||||||
|
*/}}
|
||||||
|
{{ if gt (len $processedStylesheets) 0 }}
|
||||||
|
{{ with $file := $.File }}
|
||||||
|
{{ $outputFilename := printf "%s/page.css" $.File.Dir }}
|
||||||
|
{{ $processedStylesheets = slice ($processedStylesheets
|
||||||
|
| resources.Concat $outputFilename
|
||||||
|
| fingerprint "md5") }}
|
||||||
|
{{ else }}
|
||||||
|
{{ warnf "No File for page CSS." }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ return $processedStylesheets }}
|
{{ return $processedStylesheets }}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue