jade-attachfilter
v0.0.1
Published
Attach new filters to Jade
Downloads
2
Readme
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