diff --git a/services/web/app/src/infrastructure/Modules.js b/services/web/app/src/infrastructure/Modules.js index 5c7a0243a6..59a8a193b6 100644 --- a/services/web/app/src/infrastructure/Modules.js +++ b/services/web/app/src/infrastructure/Modules.js @@ -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 + }) ) ) } diff --git a/services/web/app/src/infrastructure/Views.js b/services/web/app/src/infrastructure/Views.js index e39ec1d282..b6f61b4cdb 100644 --- a/services/web/app/src/infrastructure/Views.js +++ b/services/web/app/src/infrastructure/Views.js @@ -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) { diff --git a/services/web/config/settings.defaults.coffee b/services/web/config/settings.defaults.coffee index 6f8aa6a6a4..3b37aec294 100644 --- a/services/web/config/settings.defaults.coffee +++ b/services/web/config/settings.defaults.coffee @@ -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