{{ $main := slice (resources.Get "js/main.js") }}
{{ if .Site.Params.goToTop }}
{{ $main = $main | append (resources.Get "js/goToTop.js") }}
{{ end }}
{{ $custom := slice }}
{{ range $script := .Site.Params.additionalScripts }}
{{ $script_res := resources.Get $script }}
{{ if not $script_res}}
{{ erroridf "additional-script-loading-error" "Failed to load script \"%s\"" $script }}
{{ else }}
{{ $custom = $custom | append (resources.Get .) }}
{{ end }}
{{ end }}
{{ if hugo.IsProduction }}
{{ $main = $main | resources.Concat "js/main.js" | resources.Minify | resources.Fingerprint }}
{{ if gt (len $custom) 0 }}
{{ $custom = $custom | resources.Concat "js/custom.js" | resources.Minify | resources.Fingerprint }}
{{ end }}
{{ else }}
{{ $main = $main | resources.Concat "js/main.js" }}
{{ if gt (len $custom) 0 }}
{{ $custom = $custom | resources.Concat "js/custom.js" }}
{{ end }}
{{ end }}