0

Possible Duplicate:
ExpressJS: how to output pretty html

I'm using Express as framework for node.js. In fact I don't have any error or trouble except for one little issue when I right-click at the browser and hit the "view page source" option all my HTML code looks like a mess, is not indented that all and actually I think is one line, like:

<html><head><title>Trade</title><link rel="stylesheet" href="/css/bootstrap/bootstrap.css"/><link rel="stylesheet" href="/css/trade.css"/><link rel="stylesheet" href="/css/bootstrap/bootstrap-responsive.css"/></head><body>...

Instead of

<html>
  <head>
    <title>Trade</title>
    <link rel="stylesheet" href="/css/bootstrap/bootstrap.css"/>
    <link rel="stylesheet" href="/css/trade.css"/>
    <link rel="stylesheet" href="/css/bootstrap/bootstrap-responsive.css"/>
  </head>
 <body>

I know this is not really a problem but knowing that my code looks like this mess, keeps me awake at night ;)

Community
  • 1
  • 1
omarloren
  • 133
  • 2
  • 11
  • What does your code that renders the html look like? – Naftali Jan 14 '13 at 19:15
  • Minification is nothing to be afraid of. There are tools for re-indenting the HTML, should you need to look at it. –  Jan 14 '13 at 19:17

2 Answers2

5

just use

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

see this related question

Community
  • 1
  • 1
zemirco
  • 16,171
  • 8
  • 62
  • 96
0

There is no issue with your source being all on one line.

It will still render into valid DOM.

The reason why it is one line is probably due to the way the page was created with express.

Naftali
  • 144,921
  • 39
  • 244
  • 303
  • 1
    The issue is that it is not readable, you may want always have DOM to see it, you may be having curl/wget and it is better if they make it pretty. This is not an answer, it should be a comment – Mustafa Jan 17 '13 at 21:44