Jaml: An HTML builder a la Haml
There have been a few HTML builder APIs out there, but Ed Spencer (new lead of Ext JS) has put together something that looks and feels similar to Haml from the Ruby side.
Jaml lets you write HTML like this:
JAVASCRIPT:
-
-
div(
-
h1(“Some title”),
-
p(“Some exciting paragraph text”),
-
-
br(),
-
-
ul(
-
li(“First item”),
-
li(“Second item”),
-
li(“Third item”)
-
)
-
);
-
You can also use templates like this:
JAVASCRIPT:
-
-
Jaml.register(‘product’, function(product) {
-
div({cls: ‘product’},
-
h1(product.title),
-
-
p(product.description),
-
-
img({src: product.thumbUrl}),
-
a({href: product.imageUrl}, ‘View larger image’),
-
-
form(
-
label({‘for’: ‘quantity’}, “Quantity”),
-
input({type: ‘text’, name: ‘quantity’, id: ‘quantity’, value: 1}),
-
-
input({type: ’submit’, value: ‘Add to Cart’})
-
)
-
);
-
});
-
Check it all out on his Github repo.
Jaml: An HTML builder a la Haml



















































0 Comments
You can be the first one to leave a comment.