Skip to content

Commit

Permalink
added implementation for advanced filters gruntjs#50
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Starkov committed Sep 22, 2013
1 parent 26ebd62 commit 291f04d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tasks/jade.js
Expand Up @@ -60,9 +60,19 @@ module.exports = function(grunt) {

try {
var jade = require('jade');


if (options.filters) {
// have custom filters
Object.keys(options.filters).forEach(function(filter) {
jade.filters[filter] = options.filters[filter];
if (typeof data === 'function') {
// have custom options
jade.filters[filter] = options.filters[filter].bind({jade: jade, locals: data()});
} else {
// have no custom options
jade.filters[filter] = options.filters[filter].bind({jade: jade });
}

});
}
compiled = jade.compile(src, options);
Expand Down

0 comments on commit 291f04d

Please sign in to comment.