View engine alternatives for nodejs?

Asked

Viewed 964 times

2

Alternatives that are not Jade and similar, I try to know alternatives that can write the complete syntax (HTML and CSS)?

1 answer

7


In addition to Jade, I have worked with two other view Engines:


Basically, the ejs processes Javascript code within tags <% %> in your view. For example:

<div>
    <h1>Você gosta de pudim?</h1>
    <% if (usuario.gostaDePudim) { %>
        <h2>Você é um cara legal!</h2>
    <% } else { %>
        <h2>Você não é legal >:(</h2>
    <% } %>
</div>

Thus, if the variable usuario.gostaDePudim is true, the following HTML will be generated:

<div>
    <h1>Você gosta de pudim?>
    <h2>Você é um cara legal!</h2>
</div>

The eco works in the same way as ejs with the tags <% %>, but using Coffeescript. The example below uses the same model as the ejs:

<div>
    <h1>Você gosta de pudim?</h1>
    <% if @usuario.gostaDePudim : %>
        <h2>Você é um cara legal!</h2>
    <% else : %>
        <h2>Você não é legal >:(</h2>
    <% end %>
</div>

That one reply on Quora quotes several other view Engines:

  • Use ejs in express3 más to taking a beating to use in express4... :)

  • I added links to the Github pages of each view engine :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.