From 1cdbe4f14a7ac93662ba45197a66be46164360be Mon Sep 17 00:00:00 2001 From: Simon Pai Date: Wed, 3 Nov 2021 01:48:03 +0800 Subject: [PATCH] Fix customJS and customCSS feature (#606) * Fix customJS function In the current state the customJS feature doesn't work, because an asset will only be generated to `/public` when `.RelPermalink` is used as mentioned in the [document](https://gohugo.io/hugo-pipes/introduction/#asset-publishing). * Update CONTRIBUTORS.md * Fix customCSS as well --- CONTRIBUTORS.md | 1 + layouts/_default/baseof.html | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 92043c8..0e29e01 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -103,3 +103,4 @@ - [Kirill Feoktistov](https://feoktistoff.org) - [leins275](https://github.com/LanskovNV) - [Michael Weiss](https://mweiss.ch) +- [Simon Pai](https://github.com/simonpai) diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 215ff37..2c9adc6 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -61,7 +61,13 @@ {{ end }} {{ range .Site.Params.customCSS }} - + {{ if $.Site.IsServer }} + {{ $styles := resources.Get . }} + + {{ else }} + {{ $styles := resources.Get . | minify | fingerprint }} + + {{ end }} {{ end }} {{ range .Site.Params.customSCSS }} @@ -123,7 +129,13 @@ {{ end }} {{ range .Site.Params.customJS }} - + {{ if $.Site.IsServer }} + {{ $script := resources.Get . }} + + {{ else }} + {{ $script := resources.Get . | minify | fingerprint }} + + {{ end }} {{ end }} {{ template "_internal/google_analytics.html" . }}