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
Jade is a template engine for node. js and the default rendering engine for the Express web framework. It is a new, simplified language that compiles into HTML and is extremely useful for web developers. Jade is designed primarily for server-side templating in node.
EJS (Embedded JavaScript Templating) is one of the most popular template engines for JavaScript. As the name suggests, it lets us embed JavaScript code in a template language that is then used to generate HTML.
All jade files need to be transformed in the HTML. Also don't forget that you need to install other dependencie like express, nodemailer, etc (see requires in the source code). And the application should by available on http://localhost/3000. All Jade templates will be correctly rendered and displayed as HTML.
js, also known as PUG, is a Javascript library that was previously known as JADE. It is an easy-to-code template engine used to code HTML in a more readable fashion. One upside to PUG is that it equips developers to code reusable HTML documents by pulling data dynamically from the API.
There is also a great resource called Jade Template Syntax by example.
There's a very complete tutorial here: http://dailyjs.com/2010/11/01/node-tutorial/.
These posts are well written, step by step and with full source code available. I recommend.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With