handlebars-virtual-dom
Compile Handlebars templates to virtual-dom.
Compile this:
into this:
h("div", [
"value1",
context.variable1,
context.variable2 ? h("span", [
"value2"
]) : "nothing",
h("span", {"data-attr":(context.variable3 ? "value3" : "") + " value4"}, [
"value5"
])
);
Usage
Server/Browserify
var handlebarsVirtualDom = require("handlebars-virtual-dom");
var result = new handlebarsVirtualDom(options).compile("<h1>{{title}}</h1>");
AMD/etc
Accessible via define()
or window.handlebarsVirtualDom
.