Caching assets in rails
Be sure to do this:
Add the cache-digests gem if rails < 4
Use the gem rack-zippy or heroku-rails-deflater so the application knows how to serve gziped assets.
-
Add the assets to the config.assets.precompile array when including js or css in your views like:
= javascript_include_tag "modernizr" = stylesheet_link_tag "application"
-
Do not include the files with the relative path like:
= javascript_include_tag "/assets/v2/modernizr.js"
Otherwise those files will not be updated after assets pre-compiling.
Written by Miguel
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#