Techbubbles

Front End development with Node and Jade

This post outlines how Jade Templates helps you to build the front end pages using Node. When you install node then you will get Jade as a default templating engine.

Why Jade for templating in Node?

Jade is a templating language to simplify writing HTML. Jade syntax and keywords map directly to HTML.Jade add ability to separate and extend your HTML.Jade generates cleaner html and dynamically inserts the values into HTML through templates.

image

if you look at the jade on left in above screenshot it is simple text. The output that generates is on right-hand side which is proper html.

image

Keywords used in Jade are extends and block. The extends keyword allows a template to extend a layout or parent template. It can then override certain pre-defined blocks of content. The block keyword allows you to establish a block or replace the content of pre-defined blocks.

image

if you go to the jade language reference site http://jade-lang.com/reference/ , there you can find more templates.

Related Posts:

%d bloggers like this: