Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jade and NodeJs, any good tutorials? [closed]

Tags:

node.js

pug

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

like image 620
Lalith Avatar asked Mar 04 '11 22:03

Lalith


People also ask

What is jade used for node JS?

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.

What is EJS good for?

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.

How do I run a jade file in node JS?

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.

What is Jade and pug?

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.


2 Answers

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

like image 120
Francisco Avatar answered Sep 19 '22 19:09

Francisco


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.

like image 35
Marcos Oliveira Avatar answered Sep 19 '22 19:09

Marcos Oliveira