Combination of deflate and minify - am I creating overhead?

I minimize my css and js files on the fly with google.codes minify. I also set my .htaccess to use deflate in all my css and js files - the reason is related to some js files (like shadowbox and tinymce) link to other js files in the code. Thus, I compress apache deflate and also reduce the compression of some js and css files using gzip - I create overhead by doing this - first gzipping (minify) and then zlib (deflate) will start again. Or apache deflate will ignore already processed gzipped files that have attributes set using minify in the headers. Does anyone have any experience with this?

+6
gzip minify zlib mod-deflate
source share
3 answers

Minimization + deflation / gzipping works great.

I use mod rewrite for this purpose, I previously created all the css / js files in version 2, the original and .css.gz / .js.gz.

The browser simply sends a .js / .css request, the server checks for the existence of .js.gz / .css.gz and returns gzipped content if certain conditions match.

So it doesn’t matter that the js / css file is loaded on the fly from js (for example, shadow or tint)

Basically like that

RewriteEngine On RewriteBase / #Check for browser Accept-Encoding, RewriteCond "%{HTTP:Accept-Encoding}" "gzip.*deflate|deflate.*gzip" #check file name is endswith css or js RewriteCond %{REQUEST_FILENAME} "\.(css|js)$" #check existance of .gz file name RewriteCond %{REQUEST_FILENAME}.gz -s #rewrite it to .js.gz or .css.gz RewriteRule ^.*$ %{REQUEST_URI}.gz [L] #update some response header <FilesMatch "\.js\.gz$"> AddEncoding gzip .gz ForceType "text/javascript" </FilesMatch> <FilesMatch "\.css\.gz$"> AddEncoding gzip .gz ForceType "text/css" </FilesMatch> 
+5
source share

gzip uses the zlib compression algorithm, and most byte sequences will not compress well the second time.

+1
source share

Minify does not serve files through Apache, therefore there is no double coding.

With the DEFLATE filter, Apache gzips requests the file on the fly every time. Minimize the gzips file on first request, then send a pre-cached version for subsequent requests.

Being based on PHP, it trades performance for flexibility and ease of maintenance, but if you drop the proxy cache in front of it, it will execute as well as S.Mark configuration.

+1
source share

All Articles