From 4c88a83332861d2f662657bc4b276ea8cf36ea2c Mon Sep 17 00:00:00 2001 From: Simon Detheridge Date: Fri, 22 May 2020 12:15:45 +0100 Subject: [PATCH] Merge pull request #2819 from overleaf/jpa-sk-improve-pug-precompile [misc] improve pug precompile GitOrigin-RevId: 2eaa9be3f04c2639ca3b2fce4b36f42972622124 --- services/web/app/src/infrastructure/Views.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/services/web/app/src/infrastructure/Views.js b/services/web/app/src/infrastructure/Views.js index f3c250bcf7..e39ec1d282 100644 --- a/services/web/app/src/infrastructure/Views.js +++ b/services/web/app/src/infrastructure/Views.js @@ -5,12 +5,18 @@ const globby = require('globby') // Generate list of view names from app/views const viewList = globby - .sync('**/*.pug', { + .sync('app/views/**/*.pug', { onlyFiles: true, concurrency: 1, - ignore: '**/_*.pug', - cwd: 'app/views' + ignore: '**/_*.pug' }) + .concat( + globby.sync('modules/*/app/views/**/*.pug', { + onlyFiles: true, + concurrency: 1, + ignore: '**/_*.pug' + }) + ) .map(x => { return x.replace(/\.pug$/, '') // strip trailing .pug extension }) @@ -25,7 +31,7 @@ module.exports = { let failures = 0 viewList.forEach(view => { try { - let filename = app.get('views') + '/' + view + '.pug' + let filename = view + '.pug' pug.compileFile(filename, { cache: true }) logger.log({ view }, 'compiled') success++