Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think it really depends on the type of application you're writing. If you have a page that mostly serves individual pages, and kind of fits into your typical CRUD/MVC mold, it may not be an issue. However, if you're writing something dynamic with a ton of ajax, it is a problem :-) </p> <p>I feel your pain - I've been bitten by this a few times in various stacks. I've ended up just doing all of my list bindings with async calls in the browser that execute after the core page loads. It kind of stinks, because you like that first request to come with a page of pre-bound list data, but subsequent page to be driven by ajax calls. I just don't want to write template stuff once for the server and once for the client.</p> <p>I don't /think/ Jade supports that kind of client side binding. The good news is that there are a few popular templating languages that work both on the server, and in the browser. The two I know of are:</p> <ul> <li><a href="http://mustache.github.com/" rel="noreferrer">mustache</a></li> <li><a href="https://github.com/flatiron/plates" rel="noreferrer">plates</a></li> <li><a href="https://github.com/visionmedia/ejs" rel="noreferrer">ejs</a></li> </ul> <p>I haven't seen anyone using plates with express, as it belongs to the flatironjs project which kind of has it's own growing framework going on. There are tons of examples out there of using mustache and ejs with express:</p> <ul> <li><a href="https://github.com/visionmedia/ejs/tree/master/examples" rel="noreferrer">https://github.com/visionmedia/ejs/tree/master/examples</a></li> <li><a href="https://github.com/fat/stache" rel="noreferrer">https://github.com/fat/stache</a></li> </ul> <p>On a side note, here's a list of templating packages for node on Joyent's site:</p> <p><a href="https://github.com/joyent/node/wiki/modules#wiki-templating" rel="noreferrer">https://github.com/joyent/node/wiki/modules#wiki-templating</a></p> <p>My suggestion is to start with EJS - it's a little more down to earth with it's non-HAML-esque syntax, supports client and server binding, and seems to be well accepted in the express stack. </p> <p>Happy Coding!</p>
 

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