Reflections on Pagespeed Insights: Minify HTML?
Today while running a check on my site for whether or not Google and I get along wonderfully or not, I noticed something.
Google is recommending I minimize my HTML code.
Now, I take this stuff pretty seriously. Aside from the fact that I realize Google is the end-all-be-all when it comes to web traffic, I also honestly believe they know what’s going on and have the best interest of the Internet in mind when they make decisions like what should be recommended via their Pagespeed analysis tool. I mean, they’re just trying to speed up the web right? That benefits you and I, and it equally benefits them. Think about it. You probably watch a few YouTube videos, a bunch of movies, download email attachments or just refresh Facebook all the day long, and that’s a lot of data you’re downloading. Now imagine you were Google, crawling the web and serving up all of those previews and Gmail pages and…well, whatever else they do. Every bit that Google can shave from each and every website out there will have an overall tremendous effect on how much effort it takes them to organize the world’s information.
But minimizing HTML? I don’t know.
According to their report, I could save a whopping 524B. As in, not even half a KB.
But minimizing HTML? No, I don’t agree with it. And why, you may ask?
Well, the web is an up-and-comer. Sure, it’s been around for awhile, but it’s been a short while relative to the time the world’s been spinning or even that society’s been chugging along. It’s a relatively new tech, but I think it’s here to stay.
So that said, viewing source in a browser gives you the opportunity to see how a webpage is marked up. “Mark up” is basically the building blocks that make up the contents of what a page is. While on a piece of paper we can just write out our thoughts, in HTML we are trying to convey those thoughts in a way that can define what was meant, not just what was said.
In fact we do this on paper as well. If you’re trying to show the importance of something on a note to your kid that you’ve hung on the fridge, you might write “Do the dishes or no allowance!” and write it with a big thick marker and lots of underline marks. Those marks, and the thickness of the marker, aren’t part of the message, they’re stylistic elements used to express the inflection of the message. We actually use a very simple form of markup every day, without knowing it really.
Anyway, I don’t want to drone on about the hows that lead up as much as the why I’m thinking in particular.
Anyone who views source should be able to easily see what we’ve done with our markup in order to create the page. HTML should have no secrets, no surprises. Line breaks and indents are an important part of code, and eliminating them makes reading HTML very difficult. HTML is less of a programming language and more of a traditional language. HTML doesn’t do variables or loops. It doesn’t natively pull from databases. It conveys content, text and images mostly.
* As for minifying CSS, I think it’s also a good idea to include a quick commented link in that file to an original CSS file. Once again, if someone can learn from what we’re doing, don’t we want them to?