Jade and NodeJs, any good tutorials?


Question

I have started working with NodeJs. First, I was just using it for providing simple REST api which has access to NOSQL databases. Now I also want to build html pages and use NodeJS to serve static files, as well as dynamic content using ExpressJs. Jade seems to be the templating library on ExpressJs so planning to use it. Are there any good resources so that I can learn jade. Also is it easy to write some big html pages using jade? I'd prefer some thing like php script tags etc embeded in html files as it is more convenient.

Please let me know what you think about it and any alternatives I should look into.

Thanks

1
34
12/9/2011 6:48:26 AM

Accepted Answer

Jade is the default template engine, but it's not your only option see: http://expressjs.com/guide/using-template-engines.html

It sounds like you want a template engine that's more like <h1><% variable %></h1> you should try EJS

http://mustache.github.com/ and https://github.com/jquery/jquery-tmpl are also well supported in node.

Also of note is weld which using 100% valid html for it's templates http://blog.nodejitsu.com/micro-templates-are-dead

Personally I like Jade in combination with Stylus (same minimal markup applied to css)

17
11/25/2014 2:01:40 AM

There is also a great resource called Jade Template Syntax by example.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon