From 6a9f6dc1f5aec9a1de0c736f01c246944c4ab026 Mon Sep 17 00:00:00 2001
From: Regis Philibert <login@regisphilibert.com>
Date: Tue, 19 Jan 2021 20:40:49 +0000
Subject: [PATCH] We can settle with 0.64.0

---
 layouts/partials/site-style.html |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/layouts/partials/site-style.html b/layouts/partials/site-style.html
index c0e6a9d..d2c25e4 100644
--- a/layouts/partials/site-style.html
+++ b/layouts/partials/site-style.html
@@ -1,12 +1,22 @@
+{{/* We only process CSS if below setting is true */}}
 {{ if site.Params.ananke_process_css }}
   {{ with resources.Get "/ananke/css/main.css" }}
+    {{/* We use ToCSS on non sass to make sure node_modules paths are included and imported
+    Then we can run PostCSS on the resulting asset.
+    `use` setting allow us to skip the postcss.config file.
+     */}}
     {{ $options := (dict "targetPath" "/ananke/css/main.css" "enableSourceMap" true "precision" 6 "includePaths" (slice "node_modules")) }}
     {{ $style := . | resources.ToCSS $options | resources.PostCSS (dict "use" "postcss-cssnext") | minify }}
+    {{/* We fingerprint in production to ensure cache busting */}}
+    {{ if eq (getenv "HUGO_ENV") "production" }}
+      {{ $style = . | fingerprint }}
+    {{ end }}
     {{ with $style }}
       <link rel="stylesheet" href="{{ .RelPermalink }}" >
     {{ end }}
   {{ end }}
 {{ else }}
+  {{/* If processing is turned off, we use the assets/dist/main.?.css commited to the repo. */}}
   {{ with resources.GetMatch "/ananke/dist/main.*.css" }}
     <link rel="stylesheet" href="{{ .RelPermalink }}" >
   {{ end }}

--
Gitblit v1.10.0