How to use the nunjucks/src/environment.Environment function in nunjucks

To help you get started, we’ve selected a few nunjucks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alphagov / paas-admin / config / njk-loader.js View on Github external
wrapper: (templates, _opts) => {
      return `
        const { runtime } = require('${ctx.data.runtimePath}');
        module.exports = {
          src: {
            type: 'code',
            obj: (function(){
              ${templates[0].template};
            })()
          },
          path: '${opts.name}',
          noCache: true,
        };
      `;
    },
    env: new Environment([], getEnvironmentOptions(opts))
  });

  return {source};
}