From c015a25f3ae2b94abd4a9ef7e694925e3d76acbc Mon Sep 17 00:00:00 2001 From: Sid <122173059+hugo-sid@users.noreply.github.com> Date: Thu, 31 Aug 2023 11:30:51 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Specify=20`HUGO=5FVERSION`=20env?= =?UTF-8?q?ironment=20variable=20once=20in=20`netlify.toml`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If an environment variable (`HUGO_VERSION` in this case) has the same value for all contexts (production, deploy-preview & branch-deploy), then there is no need to specify it for each context. Specifying it once under [build.environment] should be enough. From https://docs.netlify.com/configure-builds/file-based-configuration/#deploy-contexts : "any property of a context-aware key, such as [build] or [[plugins]], will be applied to all contexts unless the same property key is present in a more specific context." --- netlify.toml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/netlify.toml b/netlify.toml index cadf7c5..9e340e9 100644 --- a/netlify.toml +++ b/netlify.toml @@ -3,22 +3,16 @@ publish = "exampleSite/public" [build.environment] +HUGO_VERSION = "0.112.7" HUGO_THEMESDIR = "../.." HUGO_THEME = "repo" TZ = "Australia/Melbourne" [context.production.environment] -HUGO_VERSION = "0.112.7" HUGO_ENV = "production" [context.deploy-preview] command = "cd exampleSite && hugo --gc --minify -D -b $DEPLOY_PRIME_URL" -[context.deploy-preview.environment] -HUGO_VERSION = "0.112.7" - [context.branch-deploy] command = "cd exampleSite && hugo --gc --minify -D -b $DEPLOY_PRIME_URL" - -[context.branch-deploy.environment] -HUGO_VERSION = "0.112.7"