Compress your html code!

kaixi

New Member
Messages
27
Reaction score
0
Points
0
I found an HTML compressor at:

http://www.freesoft.fsnet.co.uk/html01.htm

It stripes out all unecessary spaces and it's quite efficient. The bad thing is that it destroys your code layout removing all indentation, so my advice is to make an extra copy of your files before compressing so you can re-edit them in the future.

regards,

Kaixi
 

deadimp

New Member
Messages
249
Reaction score
0
Points
0
Unless you simply go crazy with your whitespace indentation (ie. using multiple spaces in place of a tab), it won't save you that much space, maybe 300-500 bytes out of a 3KB file. That's not really enough to justify obfuscating your code, unless you have millions to billions of hits per day, where it could total up to megs or even gigs of daily bandwidth - even then, do benefits outweigh the costs?
I'm not sure about dial-up, but a few hundred bytes out of a small file that's likely to be cached isn't going to be noticeable.

EDIT: You might want to change the link on your signature. It's broken.
 
Last edited:

dyfuse

Member
Messages
395
Reaction score
0
Points
16
I agree. If your HTML coding amounts to a large file, which will receive numerous and frequent hits, then this is probably on option to consider. Otherwise, it is not worth bothering.

For me, I am quite a 'clean coder' in terms of indentation and commenting... running my HTML files through this compressor would potentially ruin that clean format. If you're like me and code your HTML pages from scratch, then you tend to be more 'efficient' in typing your coding from the very beginning.

But thanks for the link - it will benefit many others out there!
 

legendphil

New Member
Messages
152
Reaction score
0
Points
0
hao!

i've heard of gzip compression function in php. I guess that would be enough to solve the php compression problem. i haven't tried writing scripts with that function yet, but wordpress has that option. so I might as well conclude that it works quite well.
 
Last edited:

lionheart8

New Member
Messages
177
Reaction score
0
Points
0
Not quite ....., in many countries in the west, where broadband is quite widespread it may be so, but remember, many internet users live in countries where broadband is just arriving or just starting to spread & is still quite expensive.

Just a small by-the-way.
 

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
In connection with dial up... I am using a HSDPA modem. I consider it dialing up. lol.

In connection with a code cleaner, you can write your own very simply and have it as a module. I personally would use perl regex as it is effiecent and what I know. Using perl it could be run from the command line eg:
c:\server\*\root>perl code_cleaner.pl c:\web_pages\index.html
Could have it remove any comment tags(depending on the comment tag used it could work with multiple languages). It could strip any blank space or any duplicate blank space. It could remove any line breaks. It could even back up the file before cleaning it.

Is something like this not better served being a profiler?
creating the correct indents, white spaces.
 
Last edited:
Top