User Tools

Site Tools


javascript:jade

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
javascript:jade [2014/03/18 03:30] – [Creating an HTML fragment] mithatjavascript:jade [2014/03/18 03:40] – [Creating web pages] mithat
Line 139: Line 139:
 <p>Nice to meet you.</p> <p>Nice to meet you.</p>
 </code> </code>
- 
-==== Creating web pages ==== 
- 
-In this section, we will use Jade to build a simple but complete web page. It will serve as an introduction to some fundamental Jade language concepts. 
- 
-<file jade myPage.jade> 
-doctype html 
-html 
-    head 
-        title A Simple Site 
-    body 
-        h1 Hello there! 
-        p Nice to meet you. 
-</file> 
- 
-<file javascript buildMyPage.js> 
-var jade = require('jade'); 
-var fs = require('fs'); 
- 
-options = { 
-    pretty: true 
-}; 
- 
-// Render an HTML page from a file 
-// written in Jade. 
-var html = jade.renderFile('myPage.jade', options); 
- 
-// Write HTML to a file. 
-fs.writeFile('myPage.html', html); 
-</file> 
- 
-output:<code> 
-$ cat myPage.html  
-<!DOCTYPE html> 
-<html> 
-  <head> 
-    <title>A Simple Site</title> 
-  </head> 
-  <body> 
-    <h1>Hello there!</h1> 
-    <p>Nice to meet you.</p> 
-  </body> 
-</html> 
-</code> 
- 
-The basic idea is that Jade uses a shorthand HTML syntax, and indentation is used to nest elements. 
- 
-This should be enough to make you comfortable reading the [[http://jade-lang.com/reference/|Jade Language Reference]], after which you should be able to compose entire web pages in Jade. 
- 
-<WRAP center round info 60%> 
-More later, time permitting. 
-</WRAP> 
  
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki