Using HTML Helpers in Node.js?

There are so many templates for node.js and express, and there is even this detailed comparison: http://paularmstrong.github.com/node-templates/index.html This led me to test EJS, Mu2 and JQTpl, and I spent a few hours of experimentation, which one is best for me.

I know that there are several questions regarding which structure is best, but none of them focus on the possibility of using assistants . I tried to create a form helper (which should display input tags and their values ​​if I pass an object to it) along with all of them, but I did not find a direct way to execute it.

Are there any recommended modules that allow me to use helpers? Perhaps even using mustache.js (which - for me - feels like the best I've tried)? Thanks in advance!

+3
source share
1 answer

I cannot tell you the comparison you are looking for, but almost all of the template models that I looked at had the opportunity for helpers.

If you use express (which you mentioned in your question), you can say that express what assistants you want to open for any used template engine (set via the application variable "view engine") - see the following sections Express guide for details :

  • - , Express . Jade, Express .
  • Server.helpers() - , .
  • Server.dynamicHelpers() ,

Express, . CoffeeKup ( fork coffeecup), Coffeescript; - ( ):

app.register('.coffee', coffeecup.adapters.express);

node, npm search express- . , express-handlebars app.helpers() app.dynamicHelpers() . ( : ).

0

All Articles