build.sh (1051B)
1 #!/bin/sh 2 3 TMP_DIR="/tmp/personal-website" 4 5 [ -d "$TMP_DIR" ] && rm -rf "$TMP_DIR" 6 7 mkdir "$TMP_DIR" 8 mkdir "${TMP_DIR}/content" 9 10 cd ~/Programs/websites/personal-website 11 12 cp -r gozer-files/templates "${TMP_DIR}/" 13 cp -r gozer-files/config.toml "${TMP_DIR}/" 14 cp -r index.md about.md "${TMP_DIR}/content/" 15 cp -r linux other blog devlog coding "${TMP_DIR}/content/" 16 cp -r static "${TMP_DIR}/public" 17 cp -r scripts/ "${TMP_DIR}/" 18 19 while read -r md_file; do 20 if grep -q "^draft = true$" "$md_file"; then 21 rm "$md_file" 22 fi 23 done <<EOF 24 $(find "${TMP_DIR}/" -type f | grep 'md$') 25 EOF 26 27 cd "$TMP_DIR" 28 gozer build 29 30 while read -r html_file; do 31 echo "$html_file" 32 ./scripts/handle-escapes.sh "$html_file" | ./scripts/header-ids.sh | tidy -q -indent > /tmp/tidy_out.html 33 mv -f /tmp/tidy_out.html "$html_file" 34 done <<EOF 35 $(find "${TMP_DIR}/build" -type f | grep 'html$') 36 EOF 37 38 # Using python http.server instead of inbuilt gozer serve as serve re-builds, overwriting my changes with ./handle-escapes.sh and tidy 39 [ "$1" = "serve" ] && python3 -m http.server -d build/