build_js template
This commit is contained in:
parent
24a0b6aa5e
commit
13e564d388
1 changed files with 19 additions and 0 deletions
19
layouts/partials/resource_builders/build_js.html
Normal file
19
layouts/partials/resource_builders/build_js.html
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{{- $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 }}
|
Loading…
Add table
Add a link
Reference in a new issue