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

前端 未结 8 1499
心在旅途
心在旅途 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:32

    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 in JavaScript, now there are projects like django-handlebars, handlebars.java, handlebars-ruby, lightncandy (PHP), and handlebars-objc.

提交回复
热议问题