I was considering using a ruby gem to compress my HTML, but we're already serving gzipped files, and I was wondering if there is any reduction in served file size by doing both HTML compression and GZIP, or if that's totally pointless.
Your files will be smaller if you minify them before using gzip.
- Gzip isn't perfect compression. It doesn't remove remove all the redundancy that minifying does.
- Gzip is lossless compression. At the very least that means it has to preserve information such as the number of indentations on each line. It may only take a byte or two for preserving that info, but if you don't remove that noise, it still is "info" to gzip.
yui-compressor and zipped both the minified and unminified versions. The un-minified version is 27% larger compared to the minified version after gzip has been applied to both.
- 130K - mega.js
- 33K - mega.js.gz
- 90K - mega.min.js
- 26K - mega.min.js.gz