I took a whack at creating a haml dialect to ease the pain of client-
side template generation.
My approach generates EJS output (http://embeddedjs.com) which I pass
through Rails' EJS compiler to generate pure javascript template
functions.

I was inspired by some other projects in this space, such as:
  haml-js (https://github.com/creationix/haml-js)
  haml-coffee (https://github.com/9elements/haml-coffee)
  ruby-haml-coffee (https://github.com/bfryd/ruby-haml-coffee)

These projects all had some drawbacks which I wanted to address.
  haml-js has to interpret pure haml templates to produce javascript
functions, and I wanted to precompile as much as possible.
  haml-coffee and ruby-haml-coffee both provide the full
expressiveness of CoffeeScript inside templates. I actually consider
this a drawback, and wanted to keep templates simple and logic-free.

All of these projects replace Ruby with JavaScript as the interpreted
language, chaning the meaning of the haml hyphen sigil. By defining a
new sigil, haml+ejs allows you to control the compilation of your
client-side templates with Ruby.

haml+ejs takes some inspiration from mustache templates, such as
keeping complex logic out of templates, but makes explicit some things
mustache does implicitly, such as iteration over collections.
haml+ejs is also dependent on jQuery for its collection iteration,
although this dependency can be swapped out.

You can check out the syntax extensions here:
  
https://github.com/duncanbeevers/haml-ejs/blob/master/test/haml-ejs/templates/suite.input

-- 
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Reply via email to