65 lines
2.3 KiB
Bash
Executable File
65 lines
2.3 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euxo pipefail
|
|
|
|
cd "${BASH_SOURCE[0]%/*}"
|
|
|
|
rm -rf build
|
|
mkdir build
|
|
|
|
./node_modules/.bin/pug -o build/ ./templates/
|
|
|
|
# (
|
|
# 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)
|
|
# )
|
|
|
|
cp -vr css/ images/ build/
|
|
|
|
render_image() {
|
|
local SIZE="${1}" FILENAME="${2}" EXTRA_OPTIONS=(-auto-orient)
|
|
EXTENSION="${FILENAME##*.}"
|
|
shift 2
|
|
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}"
|
|
exiftool -overwrite_original -all= -- "build/images/${FILENAME%.*}-${SIZE}.${EXTENSION}"
|
|
cwebp "build/images/${FILENAME%.*}-${SIZE}.${EXTENSION}" -o "build/images/${FILENAME%.*}-${SIZE}.webp"
|
|
}
|
|
|
|
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"
|
|
|
|
echo "Stripping metadata"
|
|
exiftool -overwrite_original -all= -- build/images/*.{jpg,png}
|
|
echo "Website built $(date)"
|