Skip to content

Commit

Permalink
Merge pull request #1490 from govuk-one-login/ATO-459/nunjucks-caching
Browse files Browse the repository at this point in the history
ATO-459: Performance: cache nunjucks templates
  • Loading branch information
ethanmills authored Mar 27, 2024
2 parents 94fe1c0 + 4381b3f commit 5c02bbe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/config/nunchucks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import * as nunjucks from "nunjucks";
import { Environment } from "nunjucks";
import i18next from "i18next";
import { returnLastCharactersOnly } from "../utils/phone-number";
import { getNodeEnv } from "../config";
import { ENVIRONMENT_NAME } from "../app.constants";

export function configureNunjucks(
app: express.Application,
Expand All @@ -11,7 +13,7 @@ export function configureNunjucks(
const nunjucksEnv: nunjucks.Environment = nunjucks.configure(viewsPath, {
autoescape: true,
express: app,
noCache: true,
noCache: getNodeEnv() !== ENVIRONMENT_NAME.PROD,
});

nunjucksEnv.addFilter("translate", function (key: string, options?: any) {
Expand Down

0 comments on commit 5c02bbe

Please sign in to comment.