Last active
February 24, 2018 09:55
-
-
Save Eriner/6be8c43d8aff8134f7d8fb547612aadf to your computer and use it in GitHub Desktop.
Brotli and Zopfli compression script for my blog's static resources.
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
#!/usr/bin/env zsh | |
# https://gist.github.com/Eriner/6be8c43d8aff8134f7d8fb547612aadf | |
filetypes=(html xml css) | |
zcomp() { | |
print "zopfli compressing ${1}" | |
for file in ./_site/**/*.${1}; do | |
zopfli --i1000 ${file} | |
done | |
} | |
bcomp() { | |
print "brotli compressing ${1}" | |
for file in ./_site/**/*.${1}; do | |
bro --force --quality 11 --input ${file} --output ${file}.br | |
chmod 644 ${file}.br | |
done | |
} | |
for type in ${filetypes}; do | |
zcomp ${type} | |
bcomp ${type} | |
done | |
print "done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment