From 90e0fe6a0826ee61cd65cba9869aaea29df5808f Mon Sep 17 00:00:00 2001
From: Felix Boerner <ich@felix-boerner.de>
Date: Sat, 01 Jun 2024 17:13:38 +0000
Subject: [PATCH] feat: use environment modes
---
tests/exampleSiteWithImage/docker-compose.desktop.yml | 2 +-
tests/exampleSiteWithVideo/docker-compose.desktop.yml | 2 +-
.github/workflows/test.yml | 4 ++--
tests/exampleSiteWithImage/docker-compose.mobile.yml | 2 +-
layouts/partials/head.html | 4 ++--
tests/exampleSiteWithVideo/docker-compose.mobile.yml | 2 +-
6 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 7f59072..986de6d 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -24,7 +24,7 @@
- name: Build Hugo example site with image
run: |
cd tests/exampleSiteWithImage/
- hugo --logLevel=info --baseURL= --themesDir=../../../
+ hugo --environment=development --logLevel=info --baseURL= --themesDir=../../../
- name: Upload Hugo example site with image
uses: actions/upload-artifact@v4
@@ -35,7 +35,7 @@
- name: Build Hugo example site with video
run: |
cd tests/exampleSiteWithVideo/
- hugo --logLevel=info --baseURL= --themesDir=../../../
+ hugo --environment=development --logLevel=info --baseURL= --themesDir=../../../
- name: Upload Hugo example site with video
uses: actions/upload-artifact@v4
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 9ef53f9..8687160 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -22,7 +22,7 @@
{{ with .Site.Params.favicon }}<link rel="icon" href="{{ . | absURL }}" />{{ end }}
<!-- Styles -->
-{{ if hugo.IsServer }}
+{{ if hugo.IsDevelopment }}
{{ $cssOpts := (dict "targetPath" "css/split.css" "enableSourceMap" true ) }}
{{ $styles := resources.Get "scss/split.scss" | resources.ExecuteAsTemplate "split.css" . | toCSS $cssOpts }}
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" media="screen" />
@@ -38,6 +38,6 @@
{{ end }}
<!-- Google Analytics -->
-{{ if and (.Site.Config.Services.GoogleAnalytics.ID) (not (in (printf "%#v" .Site.BaseURL) "localhost")) }}
+{{ if and (.Site.Config.Services.GoogleAnalytics.ID) (not hugo.IsDevelopment) }}
{{ template "_internal/google_analytics.html" . }}
{{ end }}
diff --git a/tests/exampleSiteWithImage/docker-compose.desktop.yml b/tests/exampleSiteWithImage/docker-compose.desktop.yml
index 901df43..c4e924a 100644
--- a/tests/exampleSiteWithImage/docker-compose.desktop.yml
+++ b/tests/exampleSiteWithImage/docker-compose.desktop.yml
@@ -5,7 +5,7 @@
- type: bind
source: ../../../
target: /src
- command: ["hugo", "server", "--logLevel=info", "--bind=0.0.0.0", "--baseURL=http://hugo", "--disableLiveReload", "--source=/src/hugo-split-theme/tests/exampleSiteWithImage", "--themesDir=/src"]
+ command: ["hugo", "server", "--environment=production", "--logLevel=info", "--bind=0.0.0.0", "--baseURL=http://hugo", "--disableLiveReload", "--source=/src/hugo-split-theme/tests/exampleSiteWithImage", "--themesDir=/src"]
ports:
- "1313:1313"
diff --git a/tests/exampleSiteWithImage/docker-compose.mobile.yml b/tests/exampleSiteWithImage/docker-compose.mobile.yml
index c82ac06..c52307b 100644
--- a/tests/exampleSiteWithImage/docker-compose.mobile.yml
+++ b/tests/exampleSiteWithImage/docker-compose.mobile.yml
@@ -5,7 +5,7 @@
- type: bind
source: ../../../
target: /src
- command: ["hugo", "server", "--logLevel=info", "--bind=0.0.0.0", "--baseURL=http://hugo", "--disableLiveReload", "--source=/src/hugo-split-theme/tests/exampleSiteWithImage", "--themesDir=/src"]
+ command: ["hugo", "server", "--environment=production", "--logLevel=info", "--bind=0.0.0.0", "--baseURL=http://hugo", "--disableLiveReload", "--source=/src/hugo-split-theme/tests/exampleSiteWithImage", "--themesDir=/src"]
ports:
- "1313:1313"
diff --git a/tests/exampleSiteWithVideo/docker-compose.desktop.yml b/tests/exampleSiteWithVideo/docker-compose.desktop.yml
index e4eedad..3193514 100644
--- a/tests/exampleSiteWithVideo/docker-compose.desktop.yml
+++ b/tests/exampleSiteWithVideo/docker-compose.desktop.yml
@@ -5,7 +5,7 @@
- type: bind
source: ../../../
target: /src
- command: ["hugo", "server", "--logLevel=info", "--bind=0.0.0.0", "--baseURL=http://hugo", "--disableLiveReload", "--source=/src/hugo-split-theme/tests/exampleSiteWithVideo", "--themesDir=/src"]
+ command: ["hugo", "server", "--environment=production", "--logLevel=info", "--bind=0.0.0.0", "--baseURL=http://hugo", "--disableLiveReload", "--source=/src/hugo-split-theme/tests/exampleSiteWithVideo", "--themesDir=/src"]
ports:
- "1313:1313"
diff --git a/tests/exampleSiteWithVideo/docker-compose.mobile.yml b/tests/exampleSiteWithVideo/docker-compose.mobile.yml
index 1af9453..1374565 100644
--- a/tests/exampleSiteWithVideo/docker-compose.mobile.yml
+++ b/tests/exampleSiteWithVideo/docker-compose.mobile.yml
@@ -5,7 +5,7 @@
- type: bind
source: ../../../
target: /src
- command: ["hugo", "server", "--logLevel=info", "--bind=0.0.0.0", "--baseURL=http://hugo", "--disableLiveReload", "--source=/src/hugo-split-theme/tests/exampleSiteWithVideo", "--themesDir=/src"]
+ command: ["hugo", "server", "--environment=production", "--logLevel=info", "--bind=0.0.0.0", "--baseURL=http://hugo", "--disableLiveReload", "--source=/src/hugo-split-theme/tests/exampleSiteWithVideo", "--themesDir=/src"]
ports:
- "1313:1313"
--
Gitblit v1.10.0