Handlebars.js for Rails 3.2
Switch branches/tags
Nothing to show
Latest commit 58bd4c7 Feb 27, 2013 @kolo Bump verstion to 0.1.



Handlebars.js for Rails 3.2. Handlebars version is 1.0.0-rc.3.

Getting started

Add the gem to your application Gemfile:

gem 'handlebars-rails', :git => 'git://github.com/kolo/handlebars-rails.git'

Run bundle install and add folowing lines to app/assets/javascripts/application.js:

//= require handlebars

Now you can create hadlebars template files by putting each template in dedicated '.jst.hjs' file (e.g. app/assets/javascripts/templates/some_template.jst.hjs)

Now you can add this file in application.js or load it in the layout.

In Javascript code templates are available through JST variable. If you have file app/assets/javascripts/templates/posts/index.jst.hjs it will be available as JST["templates/posts/index"] function.


This gem was insired by sproutcore-rails and I used code from that gem.