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

---
 /dev/null                        |    5 -----
 layouts/_default/baseof.html     |    1 -
 theme.toml                       |    2 +-
 config.yaml                      |    2 +-
 layouts/partials/site-style.html |   10 ++++++++++
 5 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/config.yaml b/config.yaml
index 177529e..2670a38 100644
--- a/config.yaml
+++ b/config.yaml
@@ -1,3 +1,3 @@
 module:
   hugoVersion:
-    min: "0.79.0"
\ No newline at end of file
+    min: "0.64.0"
\ No newline at end of file
diff --git a/data/webpack_assets.json b/data/webpack_assets.json
deleted file mode 100644
index da92d23..0000000
--- a/data/webpack_assets.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
-  "app": {
-    "js": "js/app.3fc0f988d21662902933.js",
-    "css": "css/app.4fc0b62e4b82c997bb0041217cd6b979.css"
-  }
-}
\ No newline at end of file
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 55f84e3..1b5d721 100755
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -46,6 +46,5 @@
       {{ block "main" . }}{{ end }}
     </main>
     {{ block "footer" . }}{{ partialCached "site-footer.html" . }}{{ end }}
-    {{ block "scripts" . }}{{ partialCached "site-scripts.html" . }}{{ end }}
   </body>
 </html>
diff --git a/layouts/partials/site-scripts.html b/layouts/partials/site-scripts.html
deleted file mode 100644
index 52dcd79..0000000
--- a/layouts/partials/site-scripts.html
+++ /dev/null
@@ -1,5 +0,0 @@
-{{ $script := .Site.Data.webpack_assets.app }}
-{{ with resources.Get "/ananke/js/main.js" }}
-  {{ $js := . | js.Build }}
-  <script src="{{ .RelPermalink }}"></script>
-{{ end }}
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 }}
diff --git a/theme.toml b/theme.toml
index 8032664..e842195 100755
--- a/theme.toml
+++ b/theme.toml
@@ -8,7 +8,7 @@
 homepage = "https://github.com/theNewDynamic/gohugo-theme-ananke"
 tags = ["website", "starter", "responsive", "Disqus", "blog", "Tachyons", "Multilingual", "Stackbit"]
 features = ["posts", "shortcodes", "related content", "comments"]
-min_version = "0.79.0"
+min_version = "0.64.0"
 
 [author]
   name = "theNewDynamic"

--
Gitblit v1.10.0