Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Upload optimized assets to Google Cloud Storage
# Rsync to remove old files
gsutil -m rsync -x '.git*' -c -d -r dist gs://bucket/
# Upload and gzip HTML, CSS and JavaScript
gsutil -m cp -z "html,css,js" -r dist/** gs://bucket/
# Set expires headers (6 months) on JS and CSS assets
gsutil -m setmeta -h "Cache-Control: public, max-age=15552000" gs://bucket/assets/**
# Make sure there's no expiration headers on HTML files
gsutil -m setmeta -h "Content-Type:text/html" -h "Cache-Control:private, max-age=0, no-transform" gs://bucket/**/*.html
@jacquesletesson

This comment has been minimized.

Copy link

@jacquesletesson jacquesletesson commented Apr 19, 2016

Thank you for this!

@marianoeramirez

This comment has been minimized.

Copy link

@marianoeramirez marianoeramirez commented Jan 16, 2020

Still very useful

@vkurlyan

This comment has been minimized.

Copy link

@vkurlyan vkurlyan commented Sep 4, 2020

Many thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment