2

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

mu is too short
  • 426,620
  • 70
  • 833
  • 800
Rails beginner
  • 14,321
  • 35
  • 137
  • 257

3 Answers3

4

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/

noli
  • 15,927
  • 8
  • 46
  • 62
-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.

Victor Moroz
  • 9,167
  • 1
  • 19
  • 23
-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.

mu is too short
  • 426,620
  • 70
  • 833
  • 800
  • 10
    This is no longer valid for the HerokuApp.com stack (notably: Celadon Cedar). Because requests are no longer run through a server like nginx, the application is responsible for compressing assets. http://devcenter.heroku.com/articles/http-routing#the_herokuappcom_http_stack – coreyward Dec 12 '11 at 20:17
  • @Corey: Thanks for the update, it is still valid for the the heroky.com stacks, right? – mu is too short Dec 13 '11 at 01:35
  • Yes, it's still valid for Aspen and Bamboo (anything with a .heroku.com domain). Heroku tries not to change anything on existing stacks, hence the creation of new stacks. – coreyward Dec 13 '11 at 18:47