Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Converts HTML to Jade template. Not perfect but useful enough for non-daily conversions.
branch: master

This branch is 101 commits behind donpark:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
lib
test/data
.gitignore
.npmignore
README.md
package.json

README.md

html2jade

html2jade converts HTML into Jade format.

Install

npm install html2jade

Command-line Usage

Outputs to stdout if input is URL

html2jade http://twitter.com

html2jade http://twitter.com > twitter.jade

Outputs to file if input is file

html2jade mywebpage.html # outputs mywebpage.jade
html2jade public/*.html  # converts all .html files to .jade

To generate Scalate compatible output:

html2jade --scalate http://twitter.com
html2jade --scalate http://twitter.com > twitter.jade
html2jade --scalate mywebpage.html
html2jade --scalate public/*.html

Programmatic Usage (>= 0.0.7)

To convert raw HTML into Jade:

var html2jade = require('html2jade');
var html = "<html><body>Hello World</body></html>";
html2jade.convertHtml(html, {}, function (err, jade) {
  // do your thing
});

To convert DOM document into Jade (client-side):

// assumes html2jade.js file has been loaded
Html2Jade.convertDocument(document, {}, function (err, jade) {
  // do your thing
});

Status

Mostly usable but sometimes requires fixing up, usually involving conditionals and scripts indentation.

While converting a fairly complicated theme package with ~20 HTML files, I had to hand-edit just twice.

Something went wrong with that request. Please try again.