Created
July 30, 2012 17:52
-
-
Save philfreo/3208678 to your computer and use it in GitHub Desktop.
Gzip files in a directory, upload it to s3 for Cloudfront (far futures)
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
# imgs don't need to be gzipped | |
s3cmd put -c config/.s3cfg-prod-static --acl-public --guess-mime-type --add-header "Cache-Control:public, max-age=31536000" -r static/img s3://my-bucket-name/ | |
# js/css does need gzipping | |
rm -rf static/built-gz; | |
cp -a static/built/ static/built-gz/; | |
find static/built-gz -type f | while read -r x; do gzip -9 -c "$x" > "$x.gz"; mv "$x.gz" "$x"; done; | |
s3cmd put -c config/.s3cfg-prod-static --acl-public --guess-mime-type --add-header "Cache-Control:public, max-age=31536000" --add-header "Content-Encoding: gzip" -r static/built-gz/ s3://my-bucket-name/built/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment