The way whitespace is handled in Hugo templates is difficult to understand. I accidentally pushed a broken version to production. This fixes the issue and improves the formatting of the template code.
20 lines
535 B
HTML
20 lines
535 B
HTML
{{- $resourcePath := .resource -}}
|
|
{{- $minify := .minify | default true -}}
|
|
{{- $resource := dict -}}
|
|
|
|
{{- with resources.Get $resourcePath }}
|
|
{{- if eq hugo.Environment "development" }}
|
|
{{- with . | js.Build }}
|
|
{{ $resource = . }}
|
|
{{- end }}
|
|
{{- else }}
|
|
{{- $opts := dict "minify" $minify }}
|
|
{{- with . | js.Build $opts | fingerprint }}
|
|
{{ $resource = . }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- else }}
|
|
{{ warnf "Unable to find JavaScript resource: %s" $resourcePath }}
|
|
{{- end }}
|
|
|
|
{{ return $resource }}
|