Running javascript inside the Handlebars template

I am completely unfamiliar with js templates. Handelbars seems to be a popular choice. I don’t like the syntax for fulfilling conditions, loops, etc., but since I’m quite capable and more comfortable using plain old js, and I’m not going to let anyone who doesn’t know what js is about my templates, I ask Does Handlebars support this.

Of course, the most popular choice is not always the best. I'm more of a Mootools guy, and jQuery is driving me crazy (great library, just not for me). So, if Handlebars had jQuery template engines, what would Mootools be?

+8
javascript template-engine
source share
2 answers

One of the central ideas for rudders and mustache is LOGICLESS in design and intent. They cannot now, and they never allow or recommend inserting raw JS into your templates. Some say this is the best design. If you want inline javascript, almost any other traditional template engine, like _. Template or jade or EJS is based on (or at least supports) the idea of ​​embedded JS code snippets.

+9
source share

Sorry to resume the old problem here. If you need to use steering wheels or it is not practical to change your template library, you can use Helpers from the Handlebars library.

http://handlebarsjs.com/expressions.html#helpers

+3
source share

All Articles