From 1546e90987fbc05e9afb31b45a120e5d21f94cd8 Mon Sep 17 00:00:00 2001 From: TheGroundZero <2406013+TheGroundZero@users.noreply.github.com> Date: Wed, 4 Sep 2024 07:08:38 +0000 Subject: [PATCH 1/2] Fix #482 - ToCSS Use toCSS alias. Based upon https://gohugo.io/functions/css/sass/ --- layouts/partials/head.html | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 5e239e0..839c902 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -22,9 +22,19 @@ {{ end }} -{{ $options := (dict "targetPath" "main.css" "outputStyle" "compressed" "enableSourceMap" true) }} -{{ $style := resources.Get "scss/main.scss" | resources.ToCSS $options | resources.Fingerprint }} - +{{ with resources.Get "sass/main.scss" }} + {{ $opts := dict "targetPath" "main.css" "outputStyle" "compressed" "enableSourceMap" true }} + {{ with . | toCSS $opts }} + {{ if hugo.IsDevelopment }} + + {{ else }} + {{ with . | minify | fingerprint }} + + {{ end }} + {{ end }} + {{ end }} +{{ end }} + {{ range $val := $.Site.Params.customCSS }} {{ if gt (len $val) 0 }} @@ -74,4 +84,4 @@ {{- if $.Site.Params.plausibleDataDomain }} -{{- end}} \ No newline at end of file +{{- end}} From 09f55394510cba36727cd977e7c1e5c3390adb96 Mon Sep 17 00:00:00 2001 From: TheGroundZero <2406013+TheGroundZero@users.noreply.github.com> Date: Wed, 4 Sep 2024 08:09:34 +0000 Subject: [PATCH 2/2] Update head.html Based on https://gohugo.io/hugo-pipes/transpile-sass-to-css/ --- layouts/partials/head.html | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 839c902..dd479dc 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -22,17 +22,9 @@ {{ end }} -{{ with resources.Get "sass/main.scss" }} - {{ $opts := dict "targetPath" "main.css" "outputStyle" "compressed" "enableSourceMap" true }} - {{ with . | toCSS $opts }} - {{ if hugo.IsDevelopment }} - - {{ else }} - {{ with . | minify | fingerprint }} - - {{ end }} - {{ end }} - {{ end }} +{{ $opts := dict "transpiler" "libsass" "targetPath" "main.css" "outputStyle" "compressed" "enableSourceMap" true }} +{{ with resources.Get "scss/main.scss" | toCSS $opts | minify | fingerprint }} + {{ end }}