From 55d2ae70bfda9d03caa96cb6a7119900539039f9 Mon Sep 17 00:00:00 2001 From: Razon Yang Date: Tue, 15 Oct 2024 09:51:30 +0800 Subject: [PATCH] fix: append hash into the JavaScript variables file (#53) --- layouts/partials/echarts/assets/script.html | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/layouts/partials/echarts/assets/script.html b/layouts/partials/echarts/assets/script.html index c135a31..cc44a7d 100644 --- a/layouts/partials/echarts/assets/script.html +++ b/layouts/partials/echarts/assets/script.html @@ -10,14 +10,12 @@ {{- end }} {{- with .Store.Get "eChartsJSVars" }} + {{- $hash := jsonify . | md5 }} {{- $jsVars := resources.Get "mods/echarts/js-vars.js" }} - {{- $jsVarsPath := printf "%s/echarts-vars.js" page.RelPermalink }} + {{- $jsVarsPath := printf "%s/echarts-vars.%s.js" page.RelPermalink $hash }} {{- $jsVars = $jsVars | resources.ExecuteAsTemplate $jsVarsPath . | js.Build (dict "targetPath" $jsVarsPath "minify" hugo.IsProduction) }} - {{- if hugo.IsProduction }} - {{- $jsVars = $jsVars | fingerprint }} - {{- end }} {{- end }}