summaryrefslogtreecommitdiffstats
path: root/layouts/partials/scripts.html
blob: a42e492d87869c4d6257b36f4a96a09b7f8fe980 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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 -}}