DailyJS

Jaml - Javascript HTML Generation

Ric Roberts

Subscribe

@dailyjs

Facebook

Google+

libraries HTML

Jaml - Javascript HTML Generation

Posted by Ric Roberts on .
Featured

libraries HTML

Jaml - Javascript HTML Generation

Posted by Ric Roberts on .

Ed Spencer's Jaml is a new project inspired by Ruby's Haml for generating nicely formatted
HTML in JavaScript. It uses a neat
DSL to create HTML elements:

Jaml.register('myList', function() {
    ul(
      li("First Item"),
      li("Second Item"),
      li("Third Item")
    );
});
Jaml.render('myList');

Jaml also supports templating: you can pass a hash to the
render function with data to be injected into your HTML
template. And templates can be reused inside other templates to keep
your code DRY.

See the README on
Github
for
more examples. This
article

on Ed's blog is also worth checking out for some background.