Tuesday, August 11, 2015

Jade Framework for HTML development

Jade is a template language for faster web development. This is the default template engine in node express framework. 
Jade has been inpired by another template language called HAML. Jade also shares same philosophy as HAML and they are below 

- Markup should be beautiful 
- Mark up should be DRY (Don’t Repeat Yourself) 
- Markup should be well intended 
- The HTML structure should be clear 

Below is a sample using Jade 

doctype html
html
title hello jade
body
h1 this is headding 
p this is paragraph 

Like can be seen, there is no HTML tag that appears in this sample. 

There are two ways of start using Jade 

1. Use an online cloud editor 
A cloud tool such as http://jsbin.com provides a cloud based tool 

2. Set up jade on the computer. 
npm install jade —global 
this installs jade on the computer. To check if jade is installed properly, below command can be used 

jade —-version  

jade -P hello.jade 

converts the jade file into html 

Jade as a template language, also provides options to declare variables, and iterators. 


references:
http://jade-lang.com/tutorial/

No comments:

Post a Comment