This article is part of a series created in partnership with SiteGround. Thank you for supporting the partners who make SitePoint possible.
Although there isn't clear agreement on the benefits of HTML minification, if you test your website on Google's PageSpeed Insights, part of the answer you could get as a result is that you should minify HTML, CSS and JavaScript.
Minifying a resource means getting rid of redundant elements, that is, elements which the browser doesn't need in order to process the document correctly.
Applying this concept to a HTML document, minification could include things like:
- Stripping HTML comments, as well as comments inside inline CSS and JavaScript code
- Removing white space both in HTML code and inline CSS and JavaScript
- Removing unnecessary quotes, empty attributes, etc.
- Getting rid of CDATA sections
These operations contribute to keep the file size down, but also make it easier to keep the code clean and maintainable.
GZipping Versus Minifying Resources
Is still worth minifying HTML if you're using GZip?
One of the arguments against HTML minification is that, gzipping HTML pages already gets rid of white space and reduces file size. This makes minification quite useless.
Continue reading %Cut the File Size with These Three HTML Minification Tools%
by Maria Antonietta Perna via SitePoint
No comments:
Post a Comment