From 180471112e2ccc50150a90cab1684f70ea635390 Mon Sep 17 00:00:00 2001
From: Patrick Kollitsch <patrick@davids-neighbour.com>
Date: Mon, 10 Mar 2025 09:29:18 +0000
Subject: [PATCH] refactor: move all template methods to proper GoHugo methods

---
 layouts/partials/func/style/GetMainCSS.html |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/layouts/partials/func/style/GetMainCSS.html b/layouts/partials/func/style/GetMainCSS.html
index 025f4e1..ce13c9d 100644
--- a/layouts/partials/func/style/GetMainCSS.html
+++ b/layouts/partials/func/style/GetMainCSS.html
@@ -14,11 +14,11 @@
 {{ $main_style := dict }}
 
 {{/* We prepare a slice of resources to be concatenated as one */}}
-{{ $assets_to_concat := slice }}
+{{ $assets_to_concat := collections.Slice }}
 {{/* We add locale css files to the slice in the proper order */}}
-{{ range slice "_tachyons.css" "_code.css" "_hugo-internal-templates.css" "_social-icons.css" "_styles.css" }}
-  {{ with partialCached "func/style/GetResource.html" . . }}
-    {{ $assets_to_concat = $assets_to_concat | append . }}
+{{ range collections.Slice "_tachyons.css" "_code.css" "_hugo-internal-templates.css" "_social-icons.css" "_styles.css" }}
+  {{ with partials.IncludeCached "func/style/GetResource.html" . . }}
+    {{ $assets_to_concat = $assets_to_concat | collections.Append . }}
   {{ end }}
 {{ end }}
 
@@ -26,20 +26,20 @@
 {{- $networks := $config.follow.networks -}}
 {{- $setups := (collections.Where $config.networks "slug" "in" $networks) }}
 {{ with $setups }}
-  {{ $socials_rules := slice }}
+  {{ $socials_rules := collections.Slice }}
   {{ range $service := . }}
     {{ with .color }}
-      {{ $rule := printf `
+      {{ $rule := fmt.Printf `
         .ananke-socials a.%s:hover {
           color: %s !important;
         }` $service.slug . }}
-      {{ $socials_rules = $socials_rules | append $rule }}
+      {{ $socials_rules = $socials_rules | collections.Append $rule }}
     {{ end }}
   {{ end }}
   {{ with $socials_rules }}
-    {{ $socials_rules = delimit . " " }}
+    {{ $socials_rules = collections.Delimit . " " }}
     {{ $socials_css := $socials_rules | resources.FromString "ananke/css/generated_socials.css" }}
-    {{ $assets_to_concat = $assets_to_concat | append $socials_css }}
+    {{ $assets_to_concat = $assets_to_concat | collections.Append $socials_css }}
   {{ end }}
 {{ end }}
 
@@ -47,16 +47,16 @@
 css asset directory we (unless condition below) add to aforementioned slice */}}
 {{ with site.Params.custom_css }}
   {{ range . }}
-    {{ with partialCached "func/style/GetResource.html" . . }}
-      {{ if eq .MediaType.SubType "x-scss" "x-sass" "scss" "sass" }}
+    {{ with partials.IncludeCached "func/style/GetResource.html" . . }}
+      {{ if compare.Eq .MediaType.SubType "x-scss" "x-sass" "scss" "sass" }}
         {{ if hugo.IsExtended }}
           {{/* as we cannot concatenate styles of different types, we sass/scss to be transformed to css beforehand */}}
-          {{ $assets_to_concat = $assets_to_concat | append (. | css.Sass) }}
+          {{ $assets_to_concat = $assets_to_concat | collections.Append (. | css.Sass) }}
         {{ else }}
-          {{ partial "func/warn.html" (printf "Processing of stylesheet %s of type %s has been skipped. You need Hugo Extended to process such files." .Name .MediaType.SubType) }}
+          {{ partials.Include "func/warn.html" (fmt.Printf "Processing of stylesheet %s of type %s has been skipped. You need Hugo Extended to process such files." .Name .MediaType.SubType) }}
         {{ end }}
       {{ else }}
-        {{ $assets_to_concat = $assets_to_concat | append . }}
+        {{ $assets_to_concat = $assets_to_concat | collections.Append . }}
       {{ end }}
     {{ end }}
   {{ end }}
@@ -68,10 +68,10 @@
 
   {{/* We then use toCSS to add sourceMap and minify */}}
   {{ $options := dict "enableSourceMap" true "precision" 6 }}
-  {{ $style = $style | css.Sass $options | minify }}
+  {{ $style = $style | css.Sass $options | resources.Minify }}
   {{/* We fingerprint in production for cache busting purposes */}}
   {{ if hugo.IsProduction }}
-    {{ $style = $style | fingerprint }}
+    {{ $style = $style | resources.Fingerprint }}
   {{ end }}
   {{/* We're ready to set returning variable with resulting resource */}}
   {{ $main_style = $style }}

--
Gitblit v1.10.0