From 16fac13cfed2d03679702680e024fee6c0e35da2 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sun, 10 Mar 2024 15:21:04 +0200 Subject: [PATCH] Switch to using `hugo.IsProduction` --- src/layouts/partials/scripts.html | 2 +- src/layouts/partials/stylesheet.html | 2 +- src/layouts/robots.txt | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/layouts/partials/scripts.html b/src/layouts/partials/scripts.html index 5838c6a3e..26aa98100 100644 --- a/src/layouts/partials/scripts.html +++ b/src/layouts/partials/scripts.html @@ -2,7 +2,7 @@ {{- $esbuildOptions := dict "target" "es2019" -}} -{{- if eq hugo.Environment "production" -}} +{{- if hugo.IsProduction -}} {{- $esbuildOptions = merge $esbuildOptions (dict "minify" "true") -}} {{- end -}} diff --git a/src/layouts/partials/stylesheet.html b/src/layouts/partials/stylesheet.html index 2acf259a5..44ce2b6ab 100644 --- a/src/layouts/partials/stylesheet.html +++ b/src/layouts/partials/stylesheet.html @@ -1,7 +1,7 @@ {{ $sassOptions := dict "targetPath" "/assets/css/style.css" "outputStyle" "expanded" "precision" 6 -}} {{- $postcssOptions := dict "use" "autoprefixer" "noMap" true -}} -{{- if eq hugo.Environment "production" -}} +{{- if hugo.IsProduction -}} {{- $sassOptions = merge $sassOptions (dict "outputStyle" "compressed") -}} {{- end -}} diff --git a/src/layouts/robots.txt b/src/layouts/robots.txt index 271b4f1b7..bafd23893 100644 --- a/src/layouts/robots.txt +++ b/src/layouts/robots.txt @@ -1,8 +1,7 @@ # www.robotstxt.org -{{- $isProduction := eq hugo.Environment "production" -}} {{- $isNetlify := eq (getenv "NETLIFY") "true" -}} -{{- $allowCrawling := and (not $isNetlify) $isProduction -}} +{{- $allowCrawling := and (not $isNetlify) hugo.IsProduction -}} {{ if $allowCrawling }} # Allow crawling of all content