Last active
February 24, 2018 10:18
-
-
Save Scumtron/565f130cd42460ac3cd05a2318a46dc0 to your computer and use it in GitHub Desktop.
Compression static with Brotli and Zopfli
This file contains hidden or 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 | |
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