geocation.com/build.sh

65 lines
2.3 KiB
Bash
Raw Permalink 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-13 20:07:19 -04:00
./node_modules/.bin/pug -o build/ ./templates/
2022-04-10 14:26:00 -04:00
# (
# 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-13 20:07:19 -04:00
if [[ "${SIZE}" != "full" ]]; then
EXTRA_OPTIONS+=(-resize "${SIZE}x${SIZE}^")
if [[ "${1-}" == "--square" ]]; then
EXTRA_OPTIONS+=(-background none -gravity center -extent "${SIZE}x${SIZE}")
fi
fi
convert "${EXTRA_OPTIONS[@]}" "orig/${FILENAME}" "build/images/${FILENAME%.*}-${SIZE}.${EXTENSION}"
2022-04-17 19:10:01 -04:00
exiftool -overwrite_original -all= -- "build/images/${FILENAME%.*}-${SIZE}.${EXTENSION}"
cwebp "build/images/${FILENAME%.*}-${SIZE}.${EXTENSION}" -o "build/images/${FILENAME%.*}-${SIZE}.webp"
2022-04-10 12:57:02 -04:00
}
2022-04-13 20:07:19 -04:00
render_image 200 "5._Elementary_GLOBE_Climate_Book_Cover.jpg" --square
render_image 200 "Diane_Student_Scammon_Bay.png" --square
render_image 200 "earth-small.png" --square
render_image 215 "1._TAS_Miss_Cook_Book_Cover.png"
render_image 215 "2._TIA_Book_Cover.png"
render_image 215 "3._TAS_Hydrography_Book_Cover.png"
render_image 215 "4._TAS_Fisheries_book_Cover.png"
render_image 215 "5._Elementary_GLOBE_Climate_Book_Cover.jpg"
render_image full "earth-huge.png"
# Scammon
render_image full "Scammon_2017-11-04RHawk206AlaskaNOAA.jpg"
render_image full "Scammon_2017-11-04RHawk334AlaskaNOAA.jpg"
render_image full "Scammon_2017-11-04RHawk366AlaskaNOAA.jpg"
render_image full "Scammon_2017-11-04RHawk414AlaskaNOAA.jpg"
render_image full "Scammon_2017-11-04RHawk423AlaskaNOAA.jpg"
render_image full "Diane_Student_Scammon_Bay.png"
# JASON
render_image full "JASON_3D_Climate_Seas_of_Change_Cover.png"
render_image full "JASON_Learning-_climate_expedition_2.png"
render_image full "JASON_Learning_Climate-Seas_of_Change-Cover-2015.png"
render_image full "Stanitski_Adler_JASON_Argonauts_2.png"
render_image full "Stanitski_Adler_JASON_Argonauts.png"
render_image full "Stanitski_JASON.jpg"
2022-04-10 12:57:02 -04:00
echo "Stripping metadata"
2022-04-17 19:10:01 -04:00
exiftool -overwrite_original -all= -- build/images/*.{jpg,png}
2022-04-10 12:57:02 -04:00
echo "Website built $(date)"