generated from HarshKapadia2/asciidoctor-jet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
31 lines (22 loc) · 733 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
#!/bin/sh
set -eu;
script_dir=$(dirname "${0}");
echo "Building site...";
# Create the 'build' directory if it doesn't exist
mkdir -p "${script_dir}/build";
# Remove all files from the 'build' directory to prevent residual files
rm -rf "${script_dir}/build/"*;
# Copy files to the 'build' directory
for path in \
"static" \
"manifest.webmanifest" \
"robots.txt" \
"service-worker.js" \
; do
cp -r "${script_dir}/src/${path}" "${script_dir}/build";
done;
# Build site
asciidoctor "${script_dir}/src/index.adoc" -a webfonts! -o "${script_dir}/build/index.html";
# Lazy load images
sed -i -e 's/<img/<img loading="lazy"/g' "${script_dir}/build/index.html";
echo "Asciidoctor Jet site build complete!";