#!/bin/sh HERE=$(dirname $(readlink -f ${0}))/src; KEEP=html; # output directory TEMP=$(mktemp -d); chmod 755 ${TEMP}; ## # Build options. # SASS=0; LOGO=0; HTML=0; for arg; do case "${arg}" in sass) SASS=1; ;; logo) LOGO=1; ;; html) HTML=1; ;; esac done ## # CSS # if test ${SASS} -eq 1; then (cd assets/css && ./compile.sh) fi # SASS ## # Logo # if test ${LOGO} -eq 1; then (cd assets/images && ./polyguin.sh) fi # LOGO if test ${HTML} -eq 1; then #=============================================================== docker run -v ${HERE}:${HERE} -e HERE=${HERE} -v ${TEMP}:${TEMP} -e TEMP=${TEMP} --rm -i alpine:3.17 <<'EOF' apk add findutils imagemagick; #=============================================================== ## # .psd --> .jpg ONLY in 'src/' # find ${HERE} -type f -name "*.psd" | while read k; do f="${k#*${HERE}}"; mkdir -p "${TEMP}${f%/*}"; convert "${k}[0]" -strip "${TEMP}${f%*.psd}.jpg"; done ## # template injection # find ${HERE} -type f -name "*.html" | while read k; do f="${k#*${HERE}}"; mkdir -p "${TEMP}${f%/*}"; sed > "${TEMP}${f}" "${k}" \ -e "/__HEADER__/r ${HERE}/header.fill" \ -e 's/__HEADER__//g' \ -e "/__FOOTER__/r ${HERE}/footer.fill" \ -e 's/__FOOTER__//g' \ -e "/__INDEPENDENT_SHADE__/r ${HERE}/independent.shade.fill" \ -e 's/__INDEPENDENT_SHADE__//g' \ -e "/__INDEPENDENT_WHITE__/r ${HERE}/independent.white.fill" \ -e 's/__INDEPENDENT_WHITE__//g' \ ; done chown -R 1000:1000 ${TEMP}; #=============================================================== EOF #=============================================================== ## # static assets # cp -R ${HERE}/../assets ${TEMP}; ## # robots.txt # cp ${HERE}/robots.txt ${TEMP}; ## # publish # rm -fr ${HTML}; mv ${TEMP} ${KEEP}; fi # HTML