#!/bin/sh HERE=$(dirname $(readlink -f ${0}))/src; HTML=html; rm -f ${HTML}.tgz; TEMP=$(mktemp -d); chmod 755 ${TEMP}; ## # CSS # (cd assets/css && ./compile.sh) ## # Logo # (cd assets/images && ./polyguin.sh) ## # .psd --> .jpg ONLY in 'src/' # docker run -v$(pwd):/x -w/x --rm -i alpine:3.14 <<'EOF' apk add imagemagick; 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 EOF ## # 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 ## # static assets # cp -R ${HERE}/../assets ${TEMP}; ## # # cp ${HERE}/robots.txt ${TEMP}; ## # payload # ( cd ${TEMP}; tar -pczf ../${HTML}.tgz .; ) ## # publish # rm -fr ${HTML}; mv ${TEMP} ${HTML};