Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I used Jade before. The nice thing about Jade is that you have a shorter syntax which means you can type faster. The <code>block</code> in Jade is pretty powerful which can help me a lot when dealing with complex HTML code.</p> <p>On the other hand, it is hard to do some simple stuff in Jade, thing like adding classes into a DIV based on a simple if condition. I need to put something like this </p> <pre><code>- if (isAdmin) div.admin.user - else div.user </code></pre> <p>Jade also don't differentiate between the tags and the variables which make the code very confusing (at least for me)</p> <pre><code>a(href='/user/' + user.id)= user.name </code></pre> <p>Jade is also not designer-friendly. My designer friends often give me HTML and CSS (They switched to LESS recently but still want to use HTML), and for that reason if I use Jade I need to convert HTML to Jade. Also in Jade, we need to use indentations, so if your HTML structure gets complicated, your code will look horrible (especially tables). Sometimes, I don't even know what level I am at</p> <pre><code>table thead tr td a img tr td tbody tr td </code></pre> <p>Recently, I made a switch to EJS and I am happy with it so far. It is very close to pure HTML and use the same syntax as that of the frontend template engine I am using (Underscore template). I must say that everything is easier with EJS. I don't have to do all the conversion when receiving HTML templates from my designer friend. All I have to do is to replace the dynamic parts with variables passed from ExpressJS. Stuff that make me crazy when using Jade are solved in EJS</p> <pre><code>&lt;div class="&lt;%= isAdmin? 'admin': '' %&gt; user"&gt;&lt;/div&gt; </code></pre> <p>And I can know what is what with EJS </p> <pre><code>&lt;a href="/user/&lt;%= user.id %&gt;"&gt;&lt;%= user.name %&gt;&lt;/a&gt; </code></pre> <p>If you miss the short syntax of Jade (like me) you can combine Zen-Coding and EJS which can help you speed up the progress in general. About performance, I don't see any differences</p> <p>However, EJS is not as powerful as Jade, it doesn't have blocks by default (this guy implemented a block feature for EJS <a href="https://github.com/RandomEtc/ejs-locals" rel="noreferrer">https://github.com/RandomEtc/ejs-locals</a>)</p> <p>So, it is totally depend on you to pick whatever makes you comfortable. But if you are going to use another template engine for the frontend like me, it's better if you use the same thing for both sides</p> <p>Update 16 December 2013: Recently, I have switched from EJS to Swig (which has similar concept as that of Jinja2 in Python world). The main reason is the lack of block in EJS even with the help of <code>ejs-locals</code>. Swig is also using plain HTML for templates and a lot of cool features that a template engine should have for example filters and tags which EJS doesn't have</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload