A browserify transform for turning .jade files into template functions

A Browserify Transform for Jade

Jadeify lets you use Jade templates with browserify in the simplest way possible:

var template = require("./template.jade");
document.getElementById("my-thing").innerHTML = template({
    localVar: "value",
    anotherOne: "another value"

When creating your browserify bundle, just add this line:


or if you are a command line cowboy, something along the lines of

browserify -t jadeify entry.js -o bundle.js

Note that this project peer-depends on Jade and each template will do require("jade/runtime"), so everything will just work: there's no need to add any Jade-related stuff to your bundle manually.

So yeah, now requireing any .jade files will give you back a template function. Have fun!

As with most browserify transforms, you can configure jadeify via the second argument to bundle.transform:

bundle.transform(require("jadeify"), { compileDebug: true, pretty: true });

or inside your package.json configuration:

    "name": "my-spiffy-package",
    "browserify": {
        "transform": [
            ["jadeify", { "compileDebug": true, "pretty": true }]

Any options given to jadeify will be passed through to Jade's API.