Discussion Forums
- Topic List
- Most Recent Posts
- Sign In for more options
Hi
While surfing one of the rails blog i found using true %> in layout increases the performance of page loads
Does it include only the "default" javascript files or all the files in the javascript directory?
When i tried using it in my layout, i got cannot dup symbols error
Was bit curious is it a rails 2 feature or available in lower versions also?
Balaji,
Yes, javascript_include_tag :all, :cache => true is a new feature added to Rails 2.x and it will grab all the js files within the javascripts directory. This post (http://davetroy.blogspot.com/2007/12/automatic-asset-minimization-and.html) will show you how to implement the :cache => true behaviour in your non 2.x apps.
Regards.
If you want specific files only or you need to specify the order you can do:
true %>
Keep in mind that if you use :all and you have stylesheets that redefine the same elements, only one will take precidence.
For example if a.css defines id "#top", b.css defines id "#top" and c.css defines id "#top", only one of these will actually be active in the browser, even though it will be listed in the cache css file.
This is only important if you are dynamically needing different CSS depending upon conditions set in your application (like sub-sites, user selected theming, etc).
-Kevin Elliott "WeLikeFood Beta":http://www.welikefood.com Discover great restaurants. Discover great food enthusiasts with your taste.
