Disable pug debug output with express.js web app

While developing an express app and using pug, as long as NODE_ENV !== 'production' pug outputs function bodies to stdout. I find that pretty annoying, and I only want it to output stuff to console when theres actually an error.

Can be done by setting a custom engine function for pug

app.engine('pug', (path, options, fn) => {
  options.debug = false
  return pug.__express.call(null, path, options, fn)
app.set('view engine', 'pug')



No comments yet...

Add comment