3

Is there a way to turn on line breaks? It would be useful when debugging.

I know this topic ( Node.js JADE linebreaks in source? ) says no due to performance, but on your local machine when developing, it should't be a problem.

Community
  • 1
  • 1
Alfred
  • 7,071
  • 4
  • 27
  • 35

2 Answers2

7

After a bit of searching I found the solution. Add this to your Express configuration, and it will make Jade tidy up the output:

Express 3.x CoffeeScript

app.configure "development", ->
  app.use express.errorHandler()
  app.locals.pretty = true

Express 3.x Javascript

app.configure('development', function(){
  app.use(express.errorHandler());
  app.locals.pretty = true;
});

Express 2.x CoffeeScript

app.configure "development", ->
  app.use express.errorHandler()
  app.set "view options",
    pretty: true

Express 2.x Javascript

app.configure('development', function(){
  app.use(express.errorHandler());
  app.set('view options', { pretty: true });
});
Alfred
  • 7,071
  • 4
  • 27
  • 35
0

You can run it through a beautifier for debugging

here's one written for node https://github.com/maxogden/commonjs-html-prettyprinter

generalhenry
  • 17,227
  • 4
  • 48
  • 63