Project

haml_to_js

0.0
No commit activity in last 3 years
No release in over 3 years
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](https://github.com/sdrdis/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).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

haml_to_js

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}'})

Installation

gem install haml_to_js

Usage

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.

Contributions

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

License

This project is under MIT License.

Similar utilities

haml-js

client-side-js

ruby-haml-js