Rails how to Gzip Javascript? (Heroku)
I have run 开发者_如何学Gogoogle page speed and it is saying that I should Gzip my javascript files?
How do I gzip my javascript files? My website is hosted on heroku if that mattter
You can prezip your assets by using the jammit gem, running the jammit command before deploy, and uploading directly to heroku. Just make an config/assets.yml file, and then run "jammit"
http://documentcloud.github.com/jammit/
As far as I understand it's web server's task to gzip files, I doubt you can modify heroku settings.
Besides, javascript files are usually cached by a browser, so normally it is not what you should be concerned about.
This answer is out of date but I can't delete it because it was accepted. So I'm turning it into a community wiki so that people can fix it up.
Heroku should be gzipping everything automatically (as long as the client supports it of course). From an old blog post:
All apps deployed to Heroku automatically compress pages they serve, by virtue of passing through Nginx’s gzip filter on the way out.
And from the current documentation:
On the heroku.com HTTP stack, requests enter the platform through Nginx, which handles SSL and Gzip.
精彩评论