Wynn Netherland changelog.com/posts

hogan.js: Mustache compiler from Twitter

Hogan is a console compiler for Mustache templates, complete with a fantastic name and man page.
Aiming not only for speed, Hogan boasts a parser API:

var text = "{{^check}}{{i18n}}No{{/i18n}}{{/check}}";
text +=  "{{#check}}{{i18n}}Yes{{/i18n}}{{/check}}";
var tree = Hogan.parse(Hogan.scan(text));

// outputs "# check"
console.log(tree[0].tag + " " + tree[0].name);

// outputs "Yes"

Just released on the hub, check the web site for usage.


Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00