Forum Moderators: open
I recently took a job of maintaining a website which has around 300 pages (all static HTML pages). All the pages are at least 55KB+ in size. This big page size is partly due to extra white/blank spaces incerted by a coder who was just too happy to use "enter" key or spacebar of his keyword. For example there are extra lines in javascript that is present in many pages and some 5-6 extra blank lines between </body> and </html> tags. Deleting these extra spaces will bring the page size down by around 12-15 KB.
Is there any shareware of freeware program available somewhere to get rid of all the extra white spaces and unnecessary lines in the HTML code of all the pages of a website in one go. I'll save a lot of time even if I can find something to do this job one page at a time.
There are tools that will go even further but you might be best off leaving it readable for editing and install some html compression like mod_gzip )if you are fortunate enough to be on an apache server). Mod_gzip will give you a much more radical page size reduction to most visitors (at least 50% of the current page size, usually more).
Thanks.
A friendly word of warning: keep an old copy of your non-squished HTML on hand for when you need to make edits. That squished code will give you a serious headache and makes edits nearly impossible! :)
If your site has a lot of pages, some other (more-automated) method is necessary.
However, there is a design methodology that you have to consider first. Are you going to reduce your pages and use them as your editing copy and your upload copy, or are you going to keep the formatted pages as your editing copy, compress those pages and upload the compressed version keeping the uncompressed versions for future editing?