Wynn Netherland changelog.com/posts

handlebars.js: Optimized JavaScript templating based on Mustache.js

If you’ve ever used Jan Lehnardt’s Mustache.js, a port of Chris Wanstrath’s logic-less views project Mustache, be sure and checkout Handlebars.js from Yehuda Katz. Handlebars builds on Mustaches’ namesake {{mustaches}} data binding syntax by adding support for path-based expressions, block helpers, and optimized partial support.


Binding deep hashes with Mustache can be cumbersome. Yehuda’s new path-based expressions let you specify XPath-style expressions to bind to values deep within a nested data structure. Given the following data:

var data = {"person": { "name": "Alan" }, company: {"name": "Rad, Inc." } };

you could bind to company name with an expression like:


[Source on GitHub] [Yehuda’s blog ppst]


Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00