Skip to content

Instantly share code, notes, and snippets.

@cmilfont
Created September 7, 2011 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmilfont/1201851 to your computer and use it in GitHub Desktop.
Save cmilfont/1201851 to your computer and use it in GitHub Desktop.
var engine = new Eljs({
, helpers: {
strong: function(value){/*...*/}
}
});
engine.compile("<div>${user.address.length > 0} - ${strong(user.name)}</div>")
engine.parse(json);
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()
var engine;
$.get("template.html", function(markup){
engine = new Eljs({
helpers: {
strong: function(value){/*...*/}
}
});
engine.compile(markup);
})
//...
engine.parse(json);
var engine;
$.get("template.html", function(markup){
engine = new Eljs({
template: markup,
helpers: {
strong: function(value){/*...*/}
}
});
})
//...
engine.parse(json);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment