Search code examples
node.jsswig-template

Set swig options with consolidate


I'm currently using swig with consolidate and it works fine :

app.engine('server.view.html', consolidate['swig']);

Now, I would like to tune swig options, and for example change the default value of autoescaping.

Any idea of how I can do that ?


Solution

  • I found ! If I interact directly with the swig object, it works. I added :

    var swig = require('swig')
    

    Then :

    app.engine('server.view.html', consolidate[config.templateEngine]);
    swig.setDefaults({
      autoescape: false
    });