Skip to content

Instantly share code, notes, and snippets.

@Scumtron
Last active February 24, 2018 10:18
Show Gist options
  • Save Scumtron/565f130cd42460ac3cd05a2318a46dc0 to your computer and use it in GitHub Desktop.
Save Scumtron/565f130cd42460ac3cd05a2318a46dc0 to your computer and use it in GitHub Desktop.
Compression static with Brotli and Zopfli
#!/bin/bash
filetypes=(js css)
user=user:user
zcomp() {
for file in ./static/*.${1}; do
zopfli --i1000 ${file}
chown $user ${file}.gz
done
}
bcomp() {
for file in ./static/*.${1}; do
brotli --force --quality 11 --input ${file} --output ${file}.br
chmod 644 ${file}.br
chown $user ${file}.br
done
}
for type in ${filetypes[@]}; do
zcomp ${type}
bcomp ${type}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment