-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (65 loc) · 2.27 KB
/
Makefile
File metadata and controls
78 lines (65 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Default environment
HUGO_ENVIRONMENT ?= production
# Hugo build command
HUGO_BUILD = HUGO_ENVIRONMENT=$(HUGO_ENVIRONMENT) hugo --gc --minify
# Hugo serve command
HUGO_SERVE = HUGO_ENVIRONMENT=$(HUGO_ENVIRONMENT) hugo server --enableGitInfo
# Pagefind command
PAGEFIND = npx pagefind --site "public"
.PHONY: init
init:
@echo "Initializing git submodules..."
git submodule init
git submodule update --init --recursive --depth 1
.PHONY: build
build:
@echo "Building site with Hugo (environment: $(HUGO_ENVIRONMENT))..."
$(HUGO_BUILD)
@echo "Running Pagefind..."
$(PAGEFIND)
.PHONY: serve
serve: build
@echo "Starting Hugo server (environment: $(HUGO_ENVIRONMENT))..."
$(HUGO_SERVE)
.PHONY: build-production
build-production:
@$(MAKE) build HUGO_ENVIRONMENT=production
.PHONY: build-local
build-local:
@$(MAKE) build HUGO_ENVIRONMENT=local
.PHONY: serve-production
serve-production:
@$(MAKE) serve HUGO_ENVIRONMENT=production
.PHONY: serve-local
serve-local:
@$(MAKE) serve HUGO_ENVIRONMENT=local
.PHONY: deploy-preview
deploy-preview:
@echo "Building site for Netlify preview deployment..."
HUGO_ENVIRONMENT=$(HUGO_ENVIRONMENT) hugo --gc --minify -b $(DEPLOY_PRIME_URL)
@echo "Running Pagefind..."
$(PAGEFIND)
.PHONY: clean
clean:
@echo "Cleaning up generated files..."
rm -rf public
rm -rf resources
.PHONY: help
help:
@echo "Available targets:"
@echo " init : Initialize git submodules"
@echo " build : Build Hugo site and run Pagefind indexing"
@echo " serve : Build site, run Pagefind, then start Hugo server"
@echo " build-production : Build site in production environment"
@echo " build-local : Build site in local environment"
@echo " serve-production : Build and serve site in production environment"
@echo " serve-local : Build and serve site in local environment"
@echo " deploy-preview : Build site for Netlify preview deployment"
@echo " clean : Remove generated files"
@echo ""
@echo "You can also set the environment directly:"
@echo " make build HUGO_ENVIRONMENT=production"
@echo " make serve HUGO_ENVIRONMENT=local"
@echo ""
@echo "After cloning the repository, run 'make init' to set up git submodules."
@echo "For Netlify preview deployments, use 'make deploy-preview'."