mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-27 08:41:20 +00:00
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:
parent
d612c03f8e
commit
ed141d255e
1 changed files with 4 additions and 3 deletions
|
@ -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++
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue