In your Gemfile, add this line:
bundle install. To invoke the generator and install the latest Head JS files in your
rails generate headjs:install
Now just add headjs to your head, using default rails
headjs_include_tag method the gem provides. This method is a wrapper of
headjs_include_tag(:defaults) headjs_include_tag(:all) headjs_include_tag('http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js') headjs_include_tag('jquery', 'jquery.ui', 'jquery.plugin', 'rails') headjs_include_tag(:defaults, :cache => true) headjs_include_tag(:defaults, 'jquery.ui', :cache => 'bundle')
The sources will have labels automatically assigned based on the filename (removing .js, .min.js and any other parameter).
Don't forget to use
head.ready() in any code that runs inside your views. More information in Head JS API.
headjs_include_tag as well as it's just a wrapper of
Clone the repo, run
bundle install and
bundle exec rake test.
Contributing to headjs-rails
Fork the project and send pull requests.
Author: David Bittencourt. See LICENSE.txt for further details.