Jaml - Javascript HTML Generation

09 Nov 2009 | By Ric Roberts | Tags HTML libraries

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.

blog comments powered by Disqus