Fork me on GitHub


Build Status

html2jade converts HTML into Jade format.


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.

NOT compatible with Node.js 0.11.x, 0.12.x, and io.js. Last time I checked, incompatibility stems from jsdom module used by this tool.

WANTED: I am looking for someone to take over maintenance of this tool.

While maintenance duty is very light, I think relative popularity of this tool deserves a developer who can
invest enough effort to take it to the next level: fully automated conversion. Besides, the code could use
a little brushing up as it was my first CoffeeScript project and architecture is rather half-hatched and

If you are interested, please ping me via email in my Github profile.


html2jade version prior to 0.7 support OS X and Linux only.

html2jade version 0.7+ should support OS X, Windows, and Linux.


npm install -g html2jade

Command-line Usage

Outputs to stdout if input is URL


html2jade > twitter.jade

Outputs to file if input is file

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

Convert HTML from stdin

cat mywebpage.html | html2jade -

To generate Scalate compatible output:

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

Command-line Options

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

Converting Mustache/Handlebars Templates

Jade is commonly used to generate HTML with embedded Mustache or Handlebars templates.

Be sure to use version 0.8+ if you use template expressions in element IDs or CSS class names
to avoid generating invalid Jade files.

Tools using html2jade

Web version

There is a web version of html2jade,
kindly provided by @aaronpowell.

Pascal Garber's jade2html2jade does roundtrip from jade to HTML and back. Online demo.

Linux tray app

Miniclip is a Linux tray app that quickly converts
HTML to Jade, CSS to Stylus and JS to Coffee from clipboard.


As of version 0.4, there is a simple unit test that converts HTML files in test/data directory
and compare them against Jade files in the same directory. Unit test harness requires coffee-script
and mocha to be installed globally. Run the tests with command npm test.