views:

252

answers:

3

Hello everyone,

I habe a Problem, I have to gzip a prototype Lib, but i totaly have no idea how to do this, where to start und how does it works :)

I find some tutorials but that wasn't helpfull...

So I have a folder with my JS Files

/compressed/js/ 1.js 2.js 3.js

I caling this files for a test in this file

/compresses/index.php

<link rel="javascript" type="text/js" href="js/tabs.js" />
<link rel="javascript" type="text/js" href="js/fb.js" />

So what I have to do? :)

+1  A: 

Perhaps you should look at the mod_deflate module for Apache: http://httpd.apache.org/docs/2.0/mod/mod_deflate.html

kovshenin
Have i to prepare my files somehow?
Fincha
No, although minifying them would not be a bad idea ;)
kovshenin
A: 

You need to handle this stuff using the configuration for HTTP server that you are using.

Could you please tell me which server you are using ? IIS/Apache ?

Following is link for compression with the IIS

Anil Namde
yes, i using apache
Fincha
+2  A: 

You can use apache's mod_deflate to automatically compress your files on the fly.

Example:

AddOutputFilterByType DEFLATE text/html text/xml text/css text/javascript 

[edit]

To check if your apache server has already output compression enabled, put the example above into an .htaccess file. Then load an html or js file via the server and check the headers for "Content-Encoding", if it says gzip or deflate, it is enabled.

elias
In my htaccess?Have I to prepare my js und css files? Zip them or somethink like this
Fincha
You need access to your vhost/server config to globally enable compression. You don't need to prepare your files, they're compressed automatically on request.
elias
Oh, you can use the example above in a .htaccess if output compression is enabled.
elias