Reputation: 375
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.
Upvotes: 3
Views: 2504
Reputation: 1297
I think you want the heroku-deflater gem for this, which adds middleware to serve the gzipped asset?
Upvotes: 3
Reputation: 12570
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.
Upvotes: 1