Skip to content Skip to sidebar Skip to footer

Rails How To Gzip Javascript? (heroku)

I have run google 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

Solution 1:

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/

Solution 2:

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.

Solution 3:

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.

Post a Comment for "Rails How To Gzip Javascript? (heroku)"