Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Use the awesome haml-js with sprockets
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib HamlJS template should return a function that accepts scope variable
spec Add pre-compilation of Haml templates
vendor/assets/javascripts the first commit of the haml-sprockets project
.gitignore the first commit of the haml-sprockets project
Gemfile the first commit of the haml-sprockets project
LICENSE add license and bump up version
Rakefile the first commit of the haml-sprockets project

Using HAML-JS with Sprockets and Rails 3.1


Rails 3.1 uses sprockets for its asset pipeline. Rails 3.1 has shown considerable love for SCSS and SASS but has left HAML out. We at Dharana Software Innovations are die hard HAML fans. We beleive that it is the best templating language around. So we would like to have it as a part of our client side toolkit as well. The haml-js project does exactly that. It was written for Node.js but works well with the browser too.

How to use it?

The gem includes haml-js. You would not have to download it separately. To use this gem, you need to do the following.

In the Gemfile, add the following line.

gem "haml-sprockets"

Now, you can create hamljs files under app/assets/javascripts/templates folder. You can create the templates folder, if it does not already exist.

// code for app/assets/javascripts/templates/hello.jst.hamljs
%h1 Hello HAML

You can now access the template anywhere in your javascript or coffeescript code.


This should give you back the string "<h1>Hello HAML</h1>".


This is distributed under the MIT license.

Something went wrong with that request. Please try again.