js.html (846B)
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 }}"></script> 10 {{- else }} 11 {{- with . | fingerprint }} 12 <script src="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"></script> 13 {{- end }} 14 {{- end }} 15 {{- end }} 16 {{- end }} 17 {{- with resources.Get "js/main.js" -}} 18 {{- if hugo.IsDevelopment -}} 19 <script src="{{ .RelPermalink }}"></script> 20 {{- else -}} 21 {{- with . | minify | fingerprint -}} 22 <script src="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"></script>> 23 {{- end -}} 24 {{- end -}} 25 {{- end -}}