Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Handlebar Templates for Rails 3.1

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 vendor
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 Rakefile
Octocat-spinner-32 handlebars-rails.gemspec


Easily setup and use handlebars.js with rails 3.1

Rails 3.1 setup

This gem requires the use of rails 3.1 and the use of sprockets for asset packaging.

This gem vendors the latest version of handlebars.js for Rails 3.1 and greater. The files will be added to the asset pipeline and available for you to use. You need to add the following line to the file app/assets/javascripts/application.js:

//= require handlebars


In your Gemfile, add this line:

gem "handlebars-rails"

Then run bundle install. You're done!

JavaScript Templates

This gem provides the ability to compile javascript templates using handlebars templates and makes them available on the client on a global JST object.

Any file with the extension '.js.hbs' will get compiled using handlebars templates

example app/assets/javascripts/hello.js.hbs:

Hello {{name}}!

will be compiled and available on the client as JST.hello

JST.hello({name: "Tammy"});

would render:

Hello Tammy!
Something went wrong with that request. Please try again.