jade-attachfilter

Attach new filters to Jade

npm install jade-attachfilter
1 downloads in the last week
9 downloads in the last month

Attach Filters to Jade

A convinience module for attaching arbitrary filters to Jade.

Installation

npm install jade-attachfilter

Usage

// Add a filter
var attachfilter = require('jade-attachfilter');
attachfilter('uppercase', function (str, options) {
  return str.toUpperCase();
});

// Use filter
var str  = ':uppercase\n  hello world';
var html = jade.compile(jade)();

Options

You can make Jade pass options to your filter by doing:

:myfilter(foo=bar, baz=hey)
  Do stuff with this text block.
attachfilter('myfilter', function (str, options) {
  if (options.foo === 'bar') {
    return 'no foo for you';
  }
  else {
    return str;
  }
});

License

ISC

npm loves you