public
Created

  • Download Gist
compiled.js
JavaScript
1 2 3 4 5 6 7
var engine = new Eljs({
, helpers: {
strong: function(value){/*...*/}
}
});
engine.compile("<div>${user.address.length > 0} - ${strong(user.name)}</div>")
engine.parse(json);
eljs.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
var engine = new Eljs({
template: "<div>${user.address.length > 0} - ${strong(user.name)}</div>"
, json : {
"user": {
name: "Christiano Milfont",
address: [{
country: "Brazil"
}]
}
}
, helpers: {
strong: function(value){return "<b>${value}</b>".interpolate({value:value})}
}
});
engine.parse()
eljscompiledwithajax.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12
var engine;
$.get("template.html", function(markup){
engine = new Eljs({
helpers: {
strong: function(value){/*...*/}
}
});
engine.compile(markup);
})
 
//...
engine.parse(json);
eljswithajax.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12
var engine;
$.get("template.html", function(markup){
engine = new Eljs({
template: markup,
helpers: {
strong: function(value){/*...*/}
}
});
})
 
//...
engine.parse(json);

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.