From 45b3e66cfcc1712fa63cd511c1a960c9f8bedad6 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Mon, 12 Aug 2024 18:19:17 +0100 Subject: [PATCH] Compile JS --- themes/dimension/{static => assets}/js/theme.js | 0 themes/dimension/layouts/partials/header.html | 2 +- themes/dimension/layouts/partials/js.html | 12 ++++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) rename themes/dimension/{static => assets}/js/theme.js (100%) create mode 100644 themes/dimension/layouts/partials/js.html diff --git a/themes/dimension/static/js/theme.js b/themes/dimension/assets/js/theme.js similarity index 100% rename from themes/dimension/static/js/theme.js rename to themes/dimension/assets/js/theme.js diff --git a/themes/dimension/layouts/partials/header.html b/themes/dimension/layouts/partials/header.html index 1d8f4e1..85adada 100644 --- a/themes/dimension/layouts/partials/header.html +++ b/themes/dimension/layouts/partials/header.html @@ -22,6 +22,6 @@ ` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} {{ end -}} - {{ partialCached "css.html" . }} + {{ partialCached "js.html" . }} \ No newline at end of file diff --git a/themes/dimension/layouts/partials/js.html b/themes/dimension/layouts/partials/js.html new file mode 100644 index 0000000..26517c0 --- /dev/null +++ b/themes/dimension/layouts/partials/js.html @@ -0,0 +1,12 @@ +{{- with resources.Get "js/theme.js" }} + {{- if eq hugo.Environment "development" }} + {{- with . | js.Build }} + + {{- end }} + {{- else }} + {{- $opts := dict "minify" true }} + {{- with . | js.Build $opts | fingerprint }} + + {{- end }} + {{- end }} +{{- end }}