Merge pull request #2945 from overleaf/jpa-pug-compileDebug-false

[misc] disable debug mode for pre-compile of pug templates by default

GitOrigin-RevId: 0a6798eec577f1be24017ba91f1378b16d80b528
This commit is contained in:
Jakob Ackermann 2020-06-26 11:48:18 +02:00 committed by Copybot
parent 176c0f3742
commit ccb5811cb6
3 changed files with 11 additions and 2 deletions

View file

@ -22,6 +22,7 @@ const fs = require('fs')
const Path = require('path')
const pug = require('pug')
const async = require('async')
const Settings = require('settings-sharelatex')
const MODULE_BASE_PATH = Path.resolve(__dirname + '/../../../modules')
@ -91,7 +92,10 @@ module.exports = Modules = {
)
result.push(
this.viewIncludes[view].push(
pug.compileFile(filePath, { doctype: 'html' })
pug.compileFile(filePath, {
doctype: 'html',
compileDebug: Settings.debugPugTemplates
})
)
)
}

View file

@ -1,6 +1,7 @@
const logger = require('logger-sharelatex')
const pug = require('pug')
const globby = require('globby')
const Settings = require('settings-sharelatex')
// Generate list of view names from app/views
@ -32,7 +33,10 @@ module.exports = {
viewList.forEach(view => {
try {
let filename = view + '.pug'
pug.compileFile(filename, { cache: true })
pug.compileFile(filename, {
cache: true,
compileDebug: Settings.debugPugTemplates
})
logger.log({ view }, 'compiled')
success++
} catch (err) {

View file

@ -393,6 +393,7 @@ module.exports = settings =
# Production Settings
# -------------------
debugPugTemplates: process.env['DEBUG_PUG_TEMPLATES'] == 'true'
# Should javascript assets be served minified or not. Note that you will
# need to run `grunt compile:minify` within the web-sharelatex directory