👷 Specify HUGO_VERSION environment variable once in netlify.toml

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."
This commit is contained in:
Sid 2023-08-31 11:30:51 +05:30 committed by GitHub
parent e04209d6e8
commit c015a25f3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,22 +3,16 @@
publish = "exampleSite/public" publish = "exampleSite/public"
[build.environment] [build.environment]
HUGO_VERSION = "0.112.7"
HUGO_THEMESDIR = "../.." HUGO_THEMESDIR = "../.."
HUGO_THEME = "repo" HUGO_THEME = "repo"
TZ = "Australia/Melbourne" TZ = "Australia/Melbourne"
[context.production.environment] [context.production.environment]
HUGO_VERSION = "0.112.7"
HUGO_ENV = "production" HUGO_ENV = "production"
[context.deploy-preview] [context.deploy-preview]
command = "cd exampleSite && hugo --gc --minify -D -b $DEPLOY_PRIME_URL" command = "cd exampleSite && hugo --gc --minify -D -b $DEPLOY_PRIME_URL"
[context.deploy-preview.environment]
HUGO_VERSION = "0.112.7"
[context.branch-deploy] [context.branch-deploy]
command = "cd exampleSite && hugo --gc --minify -D -b $DEPLOY_PRIME_URL" command = "cd exampleSite && hugo --gc --minify -D -b $DEPLOY_PRIME_URL"
[context.branch-deploy.environment]
HUGO_VERSION = "0.112.7"