YUI Compressor + gzip causes Illegal Character error in jQuery
- by lo_fye
When I minify jquery using YUI compressor, it works fine.
When I then add gzip compression (and serve this version via mod rewrite), the gzipped version throws this error:
illegal character in jquery.min.js on line 1
Line 1 is:
???????M???????????s?8?0???!sz?dKr?=?
This results in a "jquery is not defined" error.
I am using the following rewrite rules to serve up the gzipped versions:
#Check to see if browser can accept gzip files.
ReWriteCond %{HTTP:accept-encoding} (gzip.*)
#make sure there's no trailing .gz on the url
ReWriteCond %{REQUEST_FILENAME} !^.+\.gz$
#check to see if a .gz version of the file exists.
RewriteCond %{REQUEST_FILENAME}.gz -f
#All conditions met so add .gz to URL filename (invisibly)
RewriteRule ^(.+) $1.gz [L]
I can't find any references to this happening to anyone else.
Thoughts?