Compressed Code in WebPage

A common habit of webpage designers is to make the code beautiful and organised. Ironically many of those same designers are very Dis-organised in their home and office management.
compact code

Few reasons for doing this are that an organised text is:
☢ Good to look at and
☢ Easier to change.
☢ Bugs or variable declaration (if writing php) is easier to find.
☢ Comments are helpful if the text is too long.

But what does it do to the file size!

You have to remember that pressing Enter (↵ ), Space ( ) or Tab (            ) adds a character to your file. For a sentence like “this is a         sentence”, that’s 15 characters excluding 3 spaces. 16% of the characters are Just Spaces!

        In writing code, a lot of spaces are given to Enter and Tab spaces, sometimes collating to 25% of the characters on the file. So even if you reduce that, you’ll decrease the file size by that much.

        More importantly, you’ll decrease the webpage loading time on the viewer’s browser by a fourth, for e.g, from 8 seconds to 6 seconds. That’s a lot more customers and audiences being retained, especially those with slow connection.

How to compress code on Webpage

Keep the original file where there are spaces in our local folder. Use a HTML file compressor application to compress the file and send that copy to the server hosting the webpage.

        Whenever a change is needed in the webpage, change the original file, then compress again and send the compressed file to the server. That way, your file would be neatly organised but the file being downloaded by the viewer of your webpage would be smaller.