hugo-resource-builders/layouts/partials/resource_builders/build_js.html
Eryn Wells 31acd82fd8 Get the line breaking situation working correctly
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.
2024-11-14 08:49:09 -08:00

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 }}