There are a few different ways to go about compressing your javascript and CSS files. Most of them require you to edit your.js and .css files to include some PHP to compress the files. Another common method has you create a PHP file that will include all of the .js or .css files and then output the results. All of these methods require you to make changes to the files. This can become a hassle if you add new files in, they need to have the changes made or you need to remember to include them in the main PHP file you made.
But here is a real easy way to include it and it only requires you to edit your .htaccess and your server has to have Apache compiled with mod_deflate. Check out the code for your .htaccess after the jump.
# BEGIN Gzip
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</IfModule>
# END Gzip
You can adjust the code above to include or exclude any of the MIME types that you need or want. It will reduce the file size for those files which will speed up your site. There is a little more load on the server because of this, but it shouldn’t cause the server load to get crazy.
After you add the code to your .htaccess use this site to check if mod_deflate is available. If it isn’t ask your host if they can compile Apache with mod_deflate for you. Mine wasn’t initally and all it took was a support ticket. An hour later it was up and running.