Merge pull request #3583 from overleaf/bg-fix-view-cache-path

cache precompiled views using the absolute path

GitOrigin-RevId: 86666555860de03a96f48436e2101993caf58a5c
This commit is contained in:
Brian Gough 2021-01-20 14:07:40 +00:00 committed by Copybot
parent d612c03f8e
commit ed141d255e

View file

@ -2,6 +2,7 @@ const logger = require('logger-sharelatex')
const pug = require('pug')
const globby = require('globby')
const Settings = require('settings-sharelatex')
const path = require('path')
// Generate list of view names from app/views
@ -31,16 +32,16 @@ module.exports = {
let success = 0
let failures = 0
viewList.forEach(view => {
let filename = path.resolve(view + '.pug') // express views are cached using the absolute path
try {
let filename = view + '.pug'
pug.compileFile(filename, {
cache: true,
compileDebug: Settings.debugPugTemplates
})
logger.log({ view }, 'compiled')
logger.log({ filename }, 'compiled')
success++
} catch (err) {
logger.error({ view, err: err.message }, 'error compiling')
logger.error({ filename, err: err.message }, 'error compiling')
failures++
}
})