E
E
epexa2017-10-07 13:54:23
Node.js
epexa, 2017-10-07 13:54:23

What is a powerful templating engine for NodeJS?

Hello!
Please advise a powerful and popular template engine for NodeJS.
I used Handlebars and it worked for me, but now there are a couple of problems:

  1. It is not possible to specify several views for generation (it may be necessary to form different pages from the same parts, for example, the addition form is the same on two pages), that is, for example, pass an array:res.render('table', 'form');
  2. You cannot make any comparisons in views, etc.(if viewName == 'table')

The first and second problems can be solved through helpers, but I want some simpler solution.
In PHP, Smarty suited me, everything was done there without any problems. I'm looking for something similar that will generate everything on the server side. I saw there is even Smarty for NodeJS, but not very popular...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2017-10-07
@epexa

Try nunjucks - https://mozilla.github.io/nunjucks/
1. It has a macro for things like this:
2. You can use expressions in templates (although I also have them in handlebars, it seems).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question