1

I am trying to find a way to get my filter works on both side.

Here is the code I have on node :

var env = nunjucks.configure(__dirname + '/../templates', {
    express: app
});

env.addFilter('date', function(str){
    return 'ok';
});

And on browser side :

var env = new nunjucks.Environment();
env.addFilter('date', function(str){
    return 'ok';
});

I would like to have my filter in a place where it will be available in these two different environments but I don't find a solution to do so.

On client side I am using nunjucks-slim version. My templates are precompiled using gulp.

Thanks for your help !

4

1 に答える 1