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