diff options
Diffstat (limited to 'layouts/partials/scripts.html')
| -rw-r--r-- | layouts/partials/scripts.html | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html new file mode 100644 index 0000000..a42e492 --- /dev/null +++ b/layouts/partials/scripts.html @@ -0,0 +1,14 @@ +{{- $isProduction := (or (eq (getenv "HUGO_ENV") "production") (eq site.Params.env "production")) -}} + +{{- $scripts := slice -}} +{{- $scripts = $scripts | append (resources.Get "js/ed.js") -}} +{{- $scripts = $scripts | resources.Concat "js/common.js" -}} + +{{- $scripts = $scripts | js.Build (dict "format" "iife" "minify" $isProduction) -}} + +{{- if or (site.Params.assets.disable_fingerprinting) (not $isProduction) }} + <script src="{{ $scripts.RelPermalink }}"></script> +{{- else -}} + {{- $scripts = $scripts | fingerprint }} + <script src="{{ $scripts.RelPermalink }}" integrity="{{ $scripts.Data.Integrity }}"></script> +{{- end -}} |
