Skip to content

Commit 862c453

Browse files
committed
Makefile: add --cleanDestinationDir flag to hugo cmd invocations
Signed-off-by: Patrice Chalin <[email protected]>
1 parent 095ce4f commit 862c453

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
HUGO_VERSION = $(shell grep ^HUGO_VERSION netlify.toml | tail -n 1 | cut -d '=' -f 2 | tr -d " \"\n")
22
NODE_BIN = node_modules/.bin
33
NETLIFY_FUNC = $(NODE_BIN)/netlify-lambda
4+
DEPLOY_PRIME_URL ?=/
45

56
# The CONTAINER_ENGINE variable is used for specifying the container engine. By default 'docker' is used
67
# but this can be overridden when calling make, e.g.
@@ -29,13 +30,13 @@ module-init: ## Initialize required submodules.
2930
all: build ## Build site with production settings and put deliverables in ./public
3031

3132
build: module-check ## Build site with non-production settings and put deliverables in ./public
32-
hugo --minify --environment development
33+
hugo --cleanDestinationDir --minify --environment development
3334

3435
build-preview: module-check ## Build site with drafts and future posts enabled
35-
hugo --buildDrafts --buildFuture --environment preview
36+
hugo --cleanDestinationDir --buildDrafts --buildFuture --environment preview
3637

3738
deploy-preview: ## Deploy preview site via netlify
38-
hugo --enableGitInfo --buildFuture --environment preview -b $(DEPLOY_PRIME_URL)
39+
hugo --cleanDestinationDir --enableGitInfo --buildFuture --environment preview -b $(DEPLOY_PRIME_URL)
3940

4041
functions-build:
4142
$(NETLIFY_FUNC) build functions-src
@@ -44,11 +45,11 @@ check-headers-file:
4445
scripts/check-headers-file.sh
4546

4647
production-build: module-check ## Build the production site and ensure that noindex headers aren't added
47-
hugo --minify --environment production
48+
hugo --cleanDestinationDir --minify --environment production
4849
HUGO_ENV=production $(MAKE) check-headers-file
4950

5051
non-production-build: module-check ## Build the non-production site, which adds noindex headers to prevent indexing
51-
hugo --enableGitInfo --environment nonprod
52+
hugo --cleanDestinationDir --enableGitInfo --environment nonprod
5253

5354
serve: module-check ## Boot the development server.
5455
hugo server --buildFuture --environment development

0 commit comments

Comments
 (0)