Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Introduction to Front End Performance Optimization Combine and Minify Assets Minify Assets

Peter Campbell
Peter Campbell
18,085 Points

HTML Minify?

Why don't we minify the HTML? It seems like an obvious step if you want to further increase performance.

2 Answers

Peter,

Many reasons. First (and simplest)--minification would gain you almost no benefit with HTML. After removing a bit of white space, HTML in web pages is of negligible load.

Second, a lot of HTML is generated dynamically, on the fly, and the extra step of minifying it on the fly would negate any small benefits.

Third, most of the "weight" of an HTML page is the content, not the markup.

Given all of this, some people do minify HTML in certain situations (Google it), but it's definitely not a common (or popular) thing to do.

Hope that helps.

Ryan Ruscett
Ryan Ruscett
23,309 Points

Minify for html is in my opinion whatever lol. It good yeah but it's more about other parts of an html page or more the things that come with it I should say. For example, CSS is a big one. Take a product like IBM Web Experience Factory. It's used to develop WebSphere Portal portlets with an interactive gui. No coding required. Depending on your application, you could have tons and tons and tons of CSS. It's all auto generated for you. This is awesome, because you don't have to write it, but it easily gets out of control. Transferring that CSS and POST GET type of stuff. Can really effect performance and cause timeouts, all kinds of loading errors blah blah. So compressing your CSS is not even really an option. It's a must. So why not just compress it all. Including html. It's kind of like a Geico commercial. Minify HTML - it's just what you do, but if you want to rock you Minify it all lol.

haha does that help bring some clarity? I may of confused myself while typing that haha.