What is the cost of not cacheing javascript? If that cost is serious,
do I prefer to selectively include javascript files only for view
where they are needed? In other words I see four options:
Cache everything in layouts/application.html.erb and don’t worry
about selective inclusion of .js files where they are needed;
cache some things in (e.g., dependencies like jquery) and
selectively include the rest only where they are needed;
do not cache and only include javascript in the views it is needed;
cache nothing and include everything in layouts/
application.html.erb.
I cobbled together javascript functionality in development mode, such
that my layouts/application.html.erb file came to look like this:
When, recently, I switched into production mode, I saw that the
expected javascripts/all.js cache file had been created, but,
unfortunately, a lot of my javascript functionality was knocked out.
When I remove the :cache option from my layouts/application.html.erb
file, like this…