-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·44 lines (32 loc) · 1019 Bytes
/
build.sh
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
#!/bin/sh
# Build Hugo Project
echo "🔨 Building Hugo Site"
EXTRA_PARAMS=$@
#####
## remove dist directory
#####
if [ -d "./src/dist" ]; then
echo "🗑 Removing dist directory"
rm -rf ./src/dist
fi
## Hugo Options used for building the site
# -d dist directory
# -gc run some cleanup tasks (remove unused cache files) after the build
# --minify minify the output
# --cleanDestinationDir remove files from destination not found in static directories
# -v verbose mode
CURRENT_USER="$(id -u):$(id -g)" docker compose run --rm hugo build --minify --gc -v --cleanDestinationDir -d dist $EXTRA_PARAMS
#####
## remove unwanted files
#####
echo "🗑 Removing unwanted files"
if [ -d "./src/dist/page" ]; then
rm -rf ./src/dist/page
fi
if [ -f "./src/dist/sitemap.xml" ]; then
rm -rf ./src/dist/sitemap.xml
fi
if [ -d "./src/dist/posts/page" ]; then
rm -rf ./src/dist/posts/page
fi
echo "✅ build complete"