Is there a built-in way to loop through the properties of an object?

Built-in support since Handlebars 1.0rc1 Support for this functionality has been added to Handlebars.js, so there is no more need for external helpers. How to use it For arrays: {{#each myArray}} Index: {{@index}} Value = {{this}} {{/each}} For objects: {{#each myObject}} Key: {{@key}} Value = {{this}} {{/each}} Note that only properties passing the hasOwnProperty test … Read more

How do I accomplish an if/else in mustache.js?

This is how you do if/else in Mustache (perfectly supported): {{#repo}} <b>{{name}}</b> {{/repo}} {{^repo}} No repos 🙁 {{/repo}} Or in your case: {{#author}} {{#avatar}} <img src=”{{avatar}}”/> {{/avatar}} {{^avatar}} <img src=”/images/default_avatar.png” height=”75″ width=”75″ /> {{/avatar}} {{/author}} Look for inverted sections in the docs: https://github.com/janl/mustache.js#inverted-sections

What are the differences between Mustache.js and Handlebars.js?

You’ve pretty much nailed it, however Mustache templates can also be compiled. Mustache is missing helpers and the more advanced blocks because it strives to be logicless. Handlebars’ custom helpers can be very useful, but often end up introducing logic into your templates. Mustache has many different compilers (JavaScript, Ruby, Python, C, etc.). Handlebars began … Read more