From b860e6c775fda9374544cdb2b3cf01a2bd2aaf58 Mon Sep 17 00:00:00 2001 From: Alexander Zhang <35056002+BessieTheCookie@users.noreply.github.com> Date: Tue, 25 May 2021 11:32:39 -0700 Subject: [PATCH] fix: unminified JavaScript (#2305) Appears that behavior of recent Hugo versions changed w.r.t. JS formatting --- wowchemy/layouts/partials/site_js.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wowchemy/layouts/partials/site_js.html b/wowchemy/layouts/partials/site_js.html index d3fea22d..72e868ed 100644 --- a/wowchemy/layouts/partials/site_js.html +++ b/wowchemy/layouts/partials/site_js.html @@ -137,16 +137,16 @@ {{ range site.Params.plugins_js }} {{ $js_bundle = $js_bundle | append (resources.Get (printf "js/%s.js" .)) }} {{ end }} - {{ $js_bundle := $js_bundle | resources.Concat (printf "%s/js/wowchemy-bundle.js" .Lang) }} + {{ $js_bundle = $js_bundle | resources.Concat (printf "%s/js/wowchemy-bundle.js" .Lang) }} {{- if hugo.IsProduction -}} - {{ $js_bundle = $js_bundle | minify }} - {{- end -}} - {{ $js_bundle := slice $js_bundle_head $js_bundle | resources.Concat (printf "%s/js/wowchemy.min.js" .Lang) }} - {{- if hugo.IsProduction -}} - {{- $js_bundle = $js_bundle | js.Build (dict "format" "iife") | fingerprint "md5" -}} + {{- $js_bundle = $js_bundle | js.Build (dict "format" "iife") | minify -}} {{- else -}} {{- $js_bundle = $js_bundle | js.Build (dict "format" "iife" "sourceMap" "inline") -}} {{- end -}} + {{ $js_bundle = slice $js_bundle_head $js_bundle | resources.Concat (printf "%s/js/wowchemy.min.js" .Lang) }} + {{- if hugo.IsProduction -}} + {{ $js_bundle = $js_bundle | fingerprint "md5" }} + {{- end -}} {{ partial "custom_js" . }}