Forum Moderators: open
There is a free Dreamweaver Extension called 'Layer2Style" - I think its available from Macromedia Exchange, but if not, Google should find it.
What this does is strip all the in-line positioning and style info and place it all in the head area.
Once you finished your page, run the extension and then take all the style info in the head and dump into an external css file.
Dump all your javascript into an external file too, and you should have an HTML page that reads almost as cleanly in Notepad as it does in the browser:)
The code still needs to be downloaded of course, but now it is only downloaded once (not once for each page)
At my place of employment we use it to shrink our deployed intranet/extranet apps, usually shrinking file sizes 25% or so (mostly gained by removing comments and code formatting).
This can add up to considerable savings on larger web applications.
Be sure to keep source copies of the files! They are very difficult to read once compressed.
Tried one of those apps a while back, just couldn't deal with not be able to read the code like I always have.
A quick way around this is to set up your WYSIWYG (if that is what you are using) to not indent, break or wrap your tags. Most of the file savings comes from stripping out tabs, indents and spaces that are not needed. If you work with a left justified html format without all the tabs and indents, you'll save a considerable amount of file size.
Some of the apps can get a bit large, and every little savings helps. As an example, in one app we save approximately 150k on all of the files involved per use of the application (it is a wizard-style application with several pages and lots of client-side javascript includes).
Anything we can do to make the downloads a little snappier, especially for those poor sales types in the field with dial-up accounts, helps.
If your choice of HTML shrinking thingy doesn't do that, then the answer is to copy all your HTML files in a convenient place so when you shrink the originals you still have the unshrunk copies. To make changes, just edit the unshrunk version, then make a copy of that to overwrite the existing (shrunk) version, and shrink it.
That way you don't have to rely on some HTML editor's attempt to reconstruct your code, and -- more importantly -- you can keep your comments intact.