Sha256: 259b36a4f215bc5376d0a512fceb2914195b2d7e135c275548709bcf49754d72
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
# 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. 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" In `app/assets/javascripts/application.js` add the following line before `//= require_tree .` //=require haml 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. JST["templates/hello"]() This should give you back the string `"<h1>Hello HAML</h1>"`. [HAML]: http://haml-lang.com/ [haml-js]: https://github.com/creationix/haml-js [Dharana Software Innovations]: http://www.dharanasoft.com/
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
haml-sprockets-0.0.1 | README.md |