There have been a number of approaches to help make it simpler to use haml for client-side templates. One popular implementation is hamlbars https://github.com/jamesotron/hamlbars which provides some helper methods, and my own academic experiments in extending haml in a similar fashion here: https://github.com/duncanbeevers/haml-ejs
That said, many client-side templating languages use different or customizable delimiters, and support different subsets of javascript within the templates, from full-js-interpretation all the way down to only-top-level-properties-of-a-single-data-object, and extending haml to deal with all of these is pretty much guaranteed to only serve a subset of the needs programmers will have down the line. haml itself is already a member of the school of templating languages that provide access to the full functionality of the ruby interpreter within the template. Adding extra delimiters means a human looking over a templates needs to mentally parse two to three languages just to figure out what's going on. Is haml the way forward? Should it be re-plumbed to make adding custom delimiters part of its public API? Should it embrace generation of client-side templates and include first-class support for this new family of consumers? I don't know. So far, using haml for these purposes has been a mixed bag. The results have been great, but the friction on the way has not been pleasant. On Sat, Apr 21, 2012 at 12:40 PM, Bernie <[email protected]> wrote: > Just want to make sure I don't use time that could be spent somewheret > else. Here's the idea: > > Many JS templating languages appear to use the "{{ some_content }}" > strategy for delimiting content, and Mustache and Handlebars appear to > be the most popular among those lang's. > > Since Haml appears to not have an easy way to add custom delimeters > (parsing occurs all the way in the parser.rb file), would it make > sense to add these "{{" delimeters directly to haml? > > The end result would be something like this: > > %table > %tbody > {{# each MyApp.MyArray > %tr > %td {{ someValue }} > %tfoot > %tr > %td Some footer content > > Thoughts, concerns? > > -- > 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. > -- 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.
