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 revisionBoth sides next revision
javascript:jade [2014/03/18 03:30] – [Creating an HTML fragment] mithatjavascript:jade [2014/03/18 03:36] – [Creating web pages] mithat
Line 162: Line 162:
 }; };
  
-// Render an HTML page from a file +// Render an HTML page from a file written in Jade. 
-// written in Jade. +var html = jade.renderFile('myPage.jade', options, function(err, html) { 
-var html = jade.renderFile('myPage.jade', options);+        if (err) { 
 +           throw(err); 
 +        } 
 +        return html; 
 +    });
  
 // Write HTML to a file. // Write HTML to a file.
-fs.writeFile('myPage.html', html);+fs.writeFile('myPage.html', html, function(err) { 
 +    if (err) { 
 +        throw(err); 
 +    } 
 +});
 </file> </file>
  
Line 184: Line 192:
 </code> </code>
  
-The basic idea is that Jade uses a shorthand HTML syntax, and indentation is used to nest elements.+The basic idea is that Jade uses a shorthand HTML syntax where 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. 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