geocation.com/build.sh

42 lines
1.2 KiB
Bash
Raw Normal View History

2022-04-09 17:10:24 -04:00
#!/bin/bash
set -euxo pipefail
cd "${BASH_SOURCE[0]%/*}"
rm -rf build
mkdir build
2022-04-10 14:26:00 -04:00
./node_modules/.bin/pug ./templates/
mv ./templates/*.html build/
# (
# echo "Building HTML"
# shopt -s extglob
# while IFS= read -r -d '' || [[ "${REPLY}" ]]; do
# cat header.html "${REPLY}" footer.html >"./build/${REPLY}"
# done < <(find . -maxdepth 1 -type f -name '*.html' -not -name 'header.html' -and -not -name 'footer.html' -print0)
# )
2022-04-09 17:10:24 -04:00
cp -vr css/ images/ build/
2022-04-10 12:57:02 -04:00
render_image() {
local SIZE="${1}" FILENAME="${2}" EXTRA_OPTIONS=(-auto-orient)
2022-04-11 00:30:58 -04:00
EXTENSION="${FILENAME##*.}"
2022-04-10 12:57:02 -04:00
shift 2
2022-04-11 00:30:58 -04:00
if [[ "${1-}" == "--square" ]]; then
2022-04-10 12:57:02 -04:00
EXTRA_OPTIONS+=(-background none -gravity center -extent "${SIZE}")
fi
2022-04-11 00:30:58 -04:00
convert -resize "${SIZE}^" "${EXTRA_OPTIONS[@]}" "orig/${FILENAME}" "build/images/${FILENAME%.*}-${SIZE}.${EXTENSION}"
2022-04-10 12:57:02 -04:00
}
render_image 200x200 "5._Elementary_GLOBE_Climate_Book_Cover.jpg" --square
render_image 200x200 "Diane_Student_Scammon_Bay.png" --square
2022-04-10 23:46:08 -04:00
render_image 200x200 "earth-small.png" --square
render_image 1000x1000 "earth-huge.png" --square
2022-04-11 00:30:58 -04:00
render_image 1000x1000 "Diane_Student_Scammon_Bay.png"
2022-04-10 12:57:02 -04:00
echo "Stripping metadata"
exiftool -overwrite_original -all= -- build/images/*.*
echo "Website built $(date)"