Created
July 3, 2018 11:56
-
-
Save Yinchie/cb2ecdb321ac9b2f4bc18dc1afcd3ebd to your computer and use it in GitHub Desktop.
How I generate my Jekyll based website. Converting and compressing images and static files to WebP and Brotli after building the site.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd /home/ghost/WWW-ITCHY | |
echo "===== Checking for updates =====" | |
bundle update | |
echo "===== Build the website =====" | |
bundle exec jekyll build | |
# Does not work for directories that has a space in it. | |
echo "===== Converting images into WebP .webp =====" | |
for x in `find /var/www/itchy -type f \( -iname \*.jpeg -o -iname \*.jpg -o -iname \*.JPG -o -iname \*.png \)` | |
do cwebp -quiet -q 80 ${x} -o ${x}.webp; | |
echo "Converted $x to ${x}.webp" | |
done | |
echo "===== Compressing static files into Brotle .br =====" | |
for x in `find /var/www/itchy -type f \( -iname \*.html -o -iname \*.css -o -iname \*.js \)` | |
do brotli -v -q 9 -k -f ${x}; | |
echo "Compressed $x to ${x}.br" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment