Skip to content

Instantly share code, notes, and snippets.

@Eriner
Last active February 24, 2018 09:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Eriner/6be8c43d8aff8134f7d8fb547612aadf to your computer and use it in GitHub Desktop.
Save Eriner/6be8c43d8aff8134f7d8fb547612aadf to your computer and use it in GitHub Desktop.
Brotli and Zopfli compression script for my blog's static resources.
#!/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