浏览代码

fix: unminified JavaScript (#2305)

Appears that behavior of recent Hugo versions changed w.r.t. JS formatting
Alexander Zhang 3 年之前
父节点
当前提交
b860e6c775
共有 1 个文件被更改,包括 6 次插入6 次删除
  1. 6 6
      wowchemy/layouts/partials/site_js.html

+ 6 - 6
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 -}}
     <script src="{{ $js_bundle.RelPermalink }}"></script>
 
     {{ partial "custom_js" . }}