jade-attachfilter

0.0.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i jade-attachfilter

Weekly Downloads

0

Version

0.0.1

License

ISC

Last publish

Collaborators

  • simme