3

The Rails documentation tells me this:

By default, gzipped version of compiled assets will be generated, along with the non-gzipped version of assets.

http://guides.rubyonrails.org/asset_pipeline.html#serving-gzipped-version-of-assets

It's in a section titled 5.3 Serving GZipped version of assets. But as far as I can tell, it doesn't tell me how to serve the gzip version instead of the regular version.

I feel like I must have to change something in my script tag, no? To indicate that I want to request gzip files. At the moment I just have this line in my html head: <%= javascript_include_tag 'application' %>.

I'm sure the solution is simple, but it has eluded me.

Community
  • 1
  • 1
rPat
  • 375
  • 1
  • 13

2 Answers2

3

I think you want the heroku-deflater gem for this, which adds middleware to serve the gzipped asset?

ms-ati
  • 1,297
  • 1
  • 13
  • 17
1

Yes, maybe that Serving GZipped version of assets title is wrong as it actually indicates how to enable/disable the gzip assets generation.
But actually Rails can't do more than generate those files as serve those files is app server responsiblity. How to configure it, it depends if you're using Apache or Nginx. I guess Heroku do this automagically? but maybe I'm wrong.

Community
  • 1
  • 1
Alter Lagos
  • 12,090
  • 1
  • 70
  • 92