Converts haml to javascript
Ruby JavaScript
Switch branches/tags
Nothing to show
Latest commit 55dfbc1 Dec 27, 2012 @sdrdis sdrdis updated gemspec


haml_to_js is a ruby library and command line that converts haml to javascript.

Why an other haml to js converter (see similar utilities) ?

  • It is a extension of haml_to_star which purpose is to convert haml into any language
  • This converter is intended for front usage
  • It simplifies debugging (the generated code is readable, a variable hold haml line number so you can know exactly where the problem is)
  • It support features that other don't support (don't hesitate to raise an issue if I am no longer right):
    • if...else statements
    • Declarations such as .first{class: 'second'} will generate <div class="first second"></div>
    • Support for brackets inside parameters (ex: %div{key: 'value with bracket}'})


gem install haml_to_js


haml_to_js file or haml_to_js < file

Take a look at integration test cases in order to see what generated code looks like.

The generated code has dependencies; it needs two functions attrs and escape. It is recommended to include haml_to_js.js.


This project is hosted on github, so don't hesitate to contribute and raise issues.


This project is under MIT License.

Similar utilities