0

In the View Page Source, I see this kind of minified html output in most websites like Google and Facebook, here is the simplified example.

<html><head>/.../</head><body><div><div>/.../</div></div><div>/.../</div></body></head>
  • What this kind of html output method does?
  • May this kind of method help a small websites?
  • What do I need to do to make my html output like this?
Aruna
  • 11,959
  • 3
  • 28
  • 42
Dumb Question
  • 365
  • 1
  • 3
  • 14
  • What do you mean here? All html pages will be like this right.. – Aruna Dec 21 '16 at 05:10
  • 1
    I have no idea what you’re asking. What “kind” of HTML output do you mean? I don’t see anything special about it. What “method” are you refering to? – Sebastian Simon Dec 21 '16 at 05:10
  • minified html.. try http://www.willpeavy.com/minifier/ – Madhawa Priyashantha Dec 21 '16 at 05:12
  • I tried to use `View Page Source` to Google, Facebook and Stackoverflow, there is a big difference, Google and Facebook, their html codes are in full horizontal line, Stackoverflow on the other hand is the opposite. If you have the time to spare, please use `View Page Source` any pages of Google, Facebook and Stackoverflow and you will see the difference in the html codes display. – Dumb Question Dec 21 '16 at 05:20
  • They all minified their html – Aruna Dec 21 '16 at 05:24
  • They all are minifying the html and I have posted the answer with more details – Aruna Dec 21 '16 at 05:31

1 Answers1

2

Google, Facebook and many other sites are minifying their HTML by removing unnecessary white spaces and new lines from the HTML to send them faster to improve the performance. That’s why you can see them in one line like how we are minifying the JS and CSS files.

There are many npm modules to take care of this and automate the process and below are a few of them:

Sebastian Simon
  • 18,263
  • 7
  • 55
  • 75
Aruna
  • 11,959
  • 3
  • 28
  • 42