diff --git a/src/components/NunjucksComponent.ts b/src/components/NunjucksComponent.ts index df62556..581d496 100644 --- a/src/components/NunjucksComponent.ts +++ b/src/components/NunjucksComponent.ts @@ -32,15 +32,16 @@ export default class NunjucksComponent extends ApplicationComponent { log.warn('Couldn\'t determine coreVersion.', e); } - this.environment = new nunjucks.Environment([ - ...this.viewsPath.map(path => new nunjucks.FileSystemLoader(path)), - new nunjucks.FileSystemLoader(path.join(__dirname, '../../../views')), - new nunjucks.FileSystemLoader(path.join(__dirname, '../views')), - ], { + const opts = { autoescape: true, noCache: !config.get('view.cache'), throwOnUndefined: true, - }) + }; + this.environment = new nunjucks.Environment([ + ...this.viewsPath.map(path => new nunjucks.FileSystemLoader(path, opts)), + new nunjucks.FileSystemLoader(path.join(__dirname, '../../../views'), opts), + new nunjucks.FileSystemLoader(path.join(__dirname, '../views'), opts), + ], opts) .addGlobal('route', ( route: string, params: RouteParams = [],