From 48e66514f96e4cbab4253986c278c9757aec8578 Mon Sep 17 00:00:00 2001 From: ZhenShuo Leo <98386542+ZhenShuo2021@users.noreply.github.com> Date: Wed, 14 May 2025 18:01:45 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20chore:=20ad?= =?UTF-8?q?d=20options=20for=20faster=20development?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add example:site_core and example:site_core:en_only for faster development We need development/hugo.toml since the segments still renders images. See object graph in https://gohugo.io/configuration/segments/ --- exampleSite/config/_default/hugo.toml | 9 +++++++++ exampleSite/config/development/hugo.toml | 5 +++++ package.json | 4 +++- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 exampleSite/config/development/hugo.toml diff --git a/exampleSite/config/_default/hugo.toml b/exampleSite/config/_default/hugo.toml index ab7e4623..55333ac5 100644 --- a/exampleSite/config/_default/hugo.toml +++ b/exampleSite/config/_default/hugo.toml @@ -69,3 +69,12 @@ googleAnalytics = "G-PEDMYR1V0K" name = 'fragmentrefs' type = 'fragments' weight = 10 + +# Render only specific parts of the site for faster development. Use: hugo --renderSegments docs_only +[segments] + [segments.site_core] + [[segments.site_core.includes]] + path = '{/,/docs,/docs/**,/samples,/samples/**}' + [segments.en_only] + [[segments.en_only.includes]] + lang = 'en' diff --git a/exampleSite/config/development/hugo.toml b/exampleSite/config/development/hugo.toml new file mode 100644 index 00000000..786a900d --- /dev/null +++ b/exampleSite/config/development/hugo.toml @@ -0,0 +1,5 @@ +# Development configuration. Disable this by running: hugo server -e production +# https://gohugo.io/quick-reference/glossary/#environment + +# Exclude folders containing large numbers of images +ignoreFiles = ['content/guides', 'content/users'] \ No newline at end of file diff --git a/package.json b/package.json index 35c422c1..619f4a3e 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,9 @@ "dev-windows": "set NODE_ENV=development&& npx @tailwindcss/cli -i ./assets/css/main.css -o ./assets/css/compiled/main.css --jit -w", "build-windows": "set NODE_ENV=production&& npx @tailwindcss/cli -i ./assets/css/main.css -o ./assets/css/compiled/main.css --jit", "build-hugo": "hugo --minify -s exampleSite --themesDir ../.. -d ../docs --baseURL https://nunocoracao.github.io/blowfish/", - "example": "hugo server -E -F --minify --source exampleSite --themesDir ../.. --buildDrafts -b http://localhost/ -p 1313", + "example": "hugo server -E -F --minify --source exampleSite --themesDir ../.. --buildDrafts -b http://localhost/ -p 1313 -e production", + "example:site_core": "hugo server -E -F --minify --source exampleSite --themesDir ../.. --buildDrafts -b http://localhost/ -p 1313 --renderSegments site_core", + "example:site_core:en_only": "hugo server -E -F --minify --source exampleSite --themesDir ../.. --buildDrafts -b http://localhost/ -p 1313 --renderSegments site_core,en_only", "lighthouse": "lhci autorun" }, "repository": {