Third, Jade

Source: Internet
Author: User

Index.jade

Cmder

Jade Index.jade-p

Compiled index.html file:


Inheritance of templates
Layout.jade file:
DOCTYPE HTML
Head
Meta (charset= ' utf-8 ')
Body
Block desc
P extends from layout
Block content

Index.jade file:
Extends layout
Block content
H2 Template Inheritance


The inclusion of the template
Include head

Jade Core API
Mounting module
NPM install Jade Coffee-script less markdown--save

Jade is renamed to pug[Red Word bold]

var http = require (' http ');
var jade = require (' Jade ');

Http.createserver (function (req, res) {
Res.writehead ($, {' Content-type ': ' text/html '});

1. Compile
var fn = jade.compile (' div #{course} ', {});
var html = fn ({course: ' Jade '});

2.jade.render
var html = jade.render (' div #{course} ', {course: ' Jade Render '});

3.jade.renderfile
Pretty:true meaning is formatted
var html = jade.renderfile (' Index.jade ', {course: ' Jade RenderFile ', pretty:true});

Res.end (HTML);
}). Listen (1337, ' 127.0.0.1 ');


Console.log (' server running as 1337 ');

Third, Jade

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.