The Changelog

Open Source moves fast. Keep up.

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]

Have comments? Send a tweet to @TheChangelog on Twitter.

Subscribe to The Changelog Weekly – our weekly email covering everything that hits our open source radar.