Simple-Jade-Parser is a convenience library that makes working with Jade even easier
Switch branches/tags
Nothing to show
Clone or download
Permalink
Failed to load latest commit information.
src/parser allows for options object Feb 11, 2015
.gitignore initial commit Feb 8, 2015
README.md allows for options object Feb 11, 2015
package.json allows for options object Feb 11, 2015

README.md

#Simple-Jade-Parser Simple-Jade-Parser is a convenience library that makes working with Jade even easier. It serves as the sole reference point for rendering Jade files with a simple API that uses promises, has great error handling, and helps with "fractal design" in frameworks like Express as opposed to having a single views/ directory.

##Install

npm install simple-jade-parser

##Usage

Basic Example
var simpleJadeParser = require('simple-jade-parser');

simpleJadeParser({
    file: './foo.jade',
    data: {
        bar: 'baz',
        bop: [{a: 2, b: 3}, {a: -1, b: 5}]
    }
}).then(function(html) {
    console.log(html);
}).catch(function(err) {
    console.error(err);
});
More Interesting Example
var express = require('express');
var app = express();
var simpleJadeParser = require('simple-jade-parser');

app.get('/zoo/animals/:type', function(req, res) {
    simpleJadeParser({
        file: './zoo/animals/template.jade',
        data: {
            type: req.params.type
        },
        opts: {
            pretty: true
        }
    }).then(function(html) {
        res.status(200).send(html);
    }).catch(function(err) {
        res.status(500).send();
        console.error(err);
    });
});

var server = app.listen(3000);

##Tests $ npm test

##License MIT