GZip CSS & Javascript


#1

I was wondering how I can do that on wordpress with the externel css and javascript

There is no place like 127.0.0.1


#2

AFAIK you can’t do it automatically.

This will work though.

Compress all the files first.

  1. Login to shell
  2. Change the working directory to that of the files
  3. Run the command ‘gzip -r *.js *.css’
  4. This will find all the Javascript and CSS files in the current directory and its subdirectories. They will be compressed into new files with a .gz extension added (ie, script.js becomes script.js.gz, there will not be a script.js left)

Now edit .htaccess

  1. You can use nano if you are still in the shell -
    a. nano ~/domain/.htaccess
    b. When done press Ctrl-O and press enter to save, then press Ctrl-X to exit
  2. Add the lines below:# For files already compressed using gzip AddEncoding gzip .gz…and if you need to uncompress a file the command is ‘gzip -d filename.gz’ or ‘gunzip filename.gz’ (the uncompressed file will replace the compressed file)

:cool: openvein.org -//-


#3

And what’s the benefit of this? I suppose for dialup, CPU is more efficient than bandwidth, but at what point does this happen? I’ve never been much for using compression on a website.

-Scott


#4

I tried doing so but the website only loads up with no style as if they cannot recognize the gziped file

There is no place like 127.0.0.1