Executing javascript inside Handlebars template

前端 未结 3 1335
长情又很酷
长情又很酷 2021-01-02 02:16

I\'m totally new to js template engines. Handlebars seems to be the popular choice. I don\'t dislike the syntax for doing conditions, loops and so on, but since I\'m perfect

3条回答
  •  星月不相逢
    2021-01-02 03:07

    One of the central ideas behind handlebars and mustache is they are LOGICLESS by design and intention. They can not now, nor will they ever allow or recommend you embed raw JS in your templates. Some say this is a better design. If you want embedded javascript, almost every other traditional templating engine, such as _.template or jade or EJS is based on (or at least supports) the idea of embedded JS code snippets.

提交回复
热议问题