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

前端 未结 8 1496
心在旅途
心在旅途 2020-12-07 06:34

Major differences I\'ve seen are:

  • Handlebars adds #if, #unless, #with, and #each
  • Handlebars adds h
8条回答
  •  借酒劲吻你
    2020-12-07 07:30

    One more subtle difference is the treatment of falsy values in {{#property}}...{{/property}} blocks. Most mustache implementations will just obey JS falsiness here, not rendering the block if property is '' or '0'.

    Handlebars will render the block for '' and 0, but not other falsy values. This can cause some trouble when migrating templates.

提交回复
热议问题