فهرست منبع

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
Jakob Ackermann 6 سال پیش
والد
کامیت
ccb5811cb6

+ 5 - 1
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
+              })
             )
           )
         }

+ 5 - 1
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) {

+ 1 - 0
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