From c0d15f89e8dede306d39cc18fefa5875ea065f0b Mon Sep 17 00:00:00 2001 From: Xin Date: Mon, 28 Aug 2023 22:32:07 +0100 Subject: [PATCH] chore: proper dev and prod styles handling --- layouts/partials/head-css.html | 35 ++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/layouts/partials/head-css.html b/layouts/partials/head-css.html index 4c2606a..6e6eebe 100644 --- a/layouts/partials/head-css.html +++ b/layouts/partials/head-css.html @@ -1,14 +1,25 @@ -{{ if and (not hugo.IsProduction) (eq hugo.Environment "theme")}} - {{ $styles := resources.Get "css/styles.css" }} - {{ $styles = $styles | resources.PostCSS (dict "inlineImports" true) }} +{{- if and (not hugo.IsProduction) (eq hugo.Environment "theme") }} + {{- $styles := resources.Get "css/styles.css" }} + {{- $styles = $styles | resources.PostCSS (dict "inlineImports" true) }} -{{ else }} - {{ $styles := resources.Get "css/compiled/main.css" }} - {{ $styles = $styles | minify | fingerprint | resources.PostProcess }} - - -{{ end }} +{{- else }} + {{- $styles := resources.Get "css/compiled/main.css" -}} -{{ $custom := resources.Get "css/custom.css" }} -{{ $custom = $custom | minify | fingerprint }} - + {{- if hugo.IsProduction }} + {{- $styles = $styles | minify | fingerprint }} + + + {{- else }} + + {{- end }} +{{- end }} + + + +{{- $custom := resources.Get "css/custom.css" }} +{{- if hugo.IsProduction -}} + {{- $custom = $custom | minify | fingerprint }} + +{{- else }} + +{{- end }}