Clean Html White Space


I have just been viewing the source code on the products page and see that there is quite a bit of white space in the coding. Is there a way to clean this? Hopefully to improve speed.

Many Thanks

There is a free module in the marketplace:

I doubt that it will have any noticeable effect on speed as the default .htaccess file in cs-cart enables compression for html

I doubt that it will have any noticeable effect on speed as the default .htaccess file in cs-cart enables compression for html

DrHemp, please install the module, make some tests and inform us about the result. I am also interested in it

Ok all installed and so far it seems to work. I'll run more tests for different server location as well. Also its a great tool for disguising the source code a bit.

1% matters! It’s a disadvantage that’s this not built in the system direct.

I doubt you will be able to measure the difference with any degree of accuracy if the client/server communication is compressed (white space compresses very well) and browsers can parse through whitespace very quickly.

For dynamic pages, the overhead of eliminating it before transmission is probably far greater than the overhead of parsing it. Remember, this is all about "time to first byte", not about what you do with those bytes once they arrive at the browser.

1% matters! It's a disadvantage that's this not built in the system direct.

There are MUCH bigger fish to fry than minifying HTML. I just did a quick Firebug look at page load time for Lets say you actually got a 10% reduction in compressed file size by minifying the HTML. Your gain would be about 37 ms for the overall load time of the HTML which won't translate into 37 ms faster time to usable page for the customer as rendering can start before its fully loaded. (wasn't thinking that through - with compression it has to be decompressed first but it still won't give you 37 ms faster time due to overlap with other file loading).

But lets look at what else is going on.

jquery.min.js 134 ms

jquery.ui.min.js 185 ms

owl.carousel.min.js 207 ms

exceptions.js 203 ms

product_image_gallery.js 201 ms

analytics.js 87 ms

6 font files 164 ms, 150 ms, 54 ms, 66 ms, 51 ms, 187 ms

That's 1,689 ms total. With a small amount of effort you could probably eliminate 60-80% of that. Caching the jquery and analytics js files on the server and including all of those .js files in the cs-cart combined .js file would eliminate a ton of time and allow more overlap of loading other files and images. Not only that, your site would be more reliable as it won't hang when those google servers occasionally hang. Strangely, 5 of those font files appear to be the same font file loaded multiple times not only wasting the time to load them but blocking overlap with necessary files. Even if the multiple loads were eliminated, just getting rid of the external font alone and using built in browser fonts would eliminate far more than minifying HTML. Read about font loading and the problems it can cause as well as a good solution.

So minifying HTML is at best an extremely minor disadvantage. Lets not be penny wise and pound foolish. I'd like to see cs-cart focusing on combining ALL .js files and dealing with font load time and the nasty problems it causes (browser text display delays - Safari hiding text for up to 30 seconds!).