summaryrefslogtreecommitdiff
path: root/layouts/partials/head/js.html
blob: 0baf831be6eb31139cb06f33fdb7127ceb2a93a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{{- with resources.Get "js/main.js" }}
    {{- $opts := dict
        "minify" (not hugo.IsDevelopment)
        "sourceMap" (cond hugo.IsDevelopment "external" "")
        "targetPath" "js/main.js"
    }}
    {{- with . | js.Build $opts }}
        {{- if hugo.IsDevelopment }}
            <script defer src="{{ .RelPermalink }}"></script>
        {{- else }}
            {{- with . | fingerprint }}
                <script defer src="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"></script>
            {{- end }}
        {{- end }}
    {{- end }}
{{- end -}}