From 51ef6cf781272b5d0966357b4f4f44745c696522 Mon Sep 17 00:00:00 2001 From: Valentin Brandl Date: Mon, 5 Jun 2017 18:49:57 +0200 Subject: [PATCH] Add minify to post-receive hook --- hooks/post-receive | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hooks/post-receive b/hooks/post-receive index 89a1105..959ccd8 100644 --- a/hooks/post-receive +++ b/hooks/post-receive @@ -15,6 +15,9 @@ trap "echo 'A problem occurred. Reverting to backup.'; rsync -aqz --del $BACKUP git clone --recursive $GIT_REPO $WORKING_DIRECTORY rm -rf $PUBLIC_WWW/* $HOME/.local/bin/hugo -s $WORKING_DIRECTORY -d ${PUBLIC_WWW} -b "https://${MY_DOMAIN}" +# minify files +./bin/minify_x86-64 -r -o $PUBLIC_WWW $PUBLIC_WWW +# ahead of time compression find $PUBLIC_WWW -type f \( -name '*.html' -o -name '*.js' -o -name '*.css' -o -name '*.xml' -o -name '*.svg' \) -exec gzip -v -k -f --best {} \; -exec touch -r {} "{}.gz" \; rm -rf $WORKING_DIRECTORY trap - EXIT