Posted in Knowledge
If you’re using a lot JavaScript and CSS files on your application, you should consider this plugin to improve the perfomance your application, it will simply bundle your JavaScript and CSS in application.
To install, run this command from your Rails directory
script/plugin install git://github.com/timcharper/bundle-fu.git
and here the example for use it :
<% bundle do %> <%= javascript_include_tag :defaults %> <%= javascript_include_tag "jquery.tools.js" %> <%= stylesheet_link_tag "main" %> <%= stylesheet_link_tag "jquery.autocomplete.css" %> <% end %>
you can make it even faster by caching your CSS and JavaScript files.
This feature has been added on Rails 2.x by setting
:cache => true
or
cached_file_name
like so :
javascript_include_tag :all, :cache => true
or
javascript_include_tag "prototype", "cart", "checkout", :cache => "shop"
remember, it only works if
ActionController::Base.perform_caching = true
(this is default on production environment).
How about you? did you bundle your JavaScript and CSS files?