gZip css and javascript Drupal 5

Events happening in the community are now at Drupal community events on www.drupal.org.
gansbrest-gdo's picture

Hi!

Is it possible to gzip CSS and JS files in Drupal5?

Thanks

Comments

Using Apache2 mod_deflate?

markus_petrux's picture

...or mod_gzip, if you're running under Apache 1?

yes you can. module "support

bennos's picture

yes you can.

module "support file cache"(http://drupal.org/project/sf_cache) supports external programms like yuicompressor.

mod_gzip is another tool, but has nothing to do with compressing css or js files.

to gzip css and js on the

mfb's picture

to gzip css and js on the fly, enable mod_deflate and add to your apache config or .htaccess:
AddOutputFilterByType DEFLATE application/javascript application/x-javascript text/css
(the correct mimetype for js is application/javascript but older versions of apache serve it as application/x-javascript)

Are you using shared hosting?

bhuga-gdo's picture

If you are using shared hosting such as Dreamhost, you're probably already compressing your css/js files. Check the headers for them in Firebug.

If it's being compressed, one of the header lines will be:
Content-encoding: gzip

Edit: I just checked and my site had stopped compressing, which wasn't previously the case. Just add this to the bottom of the root .htaccess file for your Drupal site, at the end. It ought to do the trick.

<ifmodule mod_deflate.c> 
  AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript 
</ifmodule> 

mod_gzip or mod-deflate Both

bennos's picture

mod_gzip or mod-deflate

Both apache modules are compressing the the request stream, but this is not the same as compressing CSS Files.

Compressing CSS Files reduze the files size. It is completly different.

http://www.arbeitsplatz24.com - http://www.conews.de - http://www.sumacom.de

High performance

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: