19 lines
533 B
HTML
19 lines
533 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 }}
|