'use strict';

var Twig = require('twig'),
  twig = Twig.twig;
Twig.cache(false);

// pretty the json output, convenient for debugging
Twig.extendFilter("json", function(value){
    return JSON.stringify(value || "", null, 2);
});

function twigCompile(data) {
    return twig({
      data: data.text,
      path: data.path
    });
}

function twigRenderer(data, locals) {
  return twigCompile(data).render(locals);
}

twigRenderer.compile = function(data) {
    return function(locals) {
        return twigCompile(data).render(locals);
    }
};

module.exports = twigRenderer;

'use strict';

var Twig = require('twig'),
  twig = Twig.twig;
Twig.cache(false);

// pretty the json output, convenient for debugging
Twig.extendFilter("json", function(value){
    return JSON.stringify(value || "", null, 2);
});

function twigCompile(data) {
    return twig({
      data: data.text,
      path: data.path
    });
}

function twigRenderer(data, locals) {
  return twigCompile(data).render(locals);
}

twigRenderer.compile = function(data) {
    return function(locals) {
        return twigCompile(data).render(locals);
    }
};

twigRenderer.disableNunjucks = true;

module.exports = twigRenderer;

Disable Nunjucks engine when page is being rendered using Twig
Disable Nunjucks engine when page is being rendered using Twig
