0.0.1 • Published 11 years ago

jade-attachfilter v0.0.1

Weekly downloads
1
License
-
Repository
-
Last release
11 years ago

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