Development Web - GZip Javascript/CSS

Discussion in 'Software' started by Ljs, 17 Oct 2013.

  1. Ljs

    Ljs Modder

    Joined:
    4 Sep 2009
    Posts:
    2,220
    Likes Received:
    112
    So while I'm changing my website and adding a few bits to it I thought I'd optimise it too. After running it through a few online tools I settled on using GTMetrix.

    This is mostly/all new territory for me!

    One of the suggestions was to GZip my Javascript files. After reading through a lot of things that didn't really make sense to me (not very beginner friendly at all) I came across Zbugs.

    This produced 2 GZip files for all of my Javascript and CSS but I really am not sure how to implement them and can't seem to find any documentation.

    I am using TSOHost (Linux) and can't find much on their forum so I am kind of assuming (although I haven't yet looked) that this should already be set up as it is a relatively noob friendly hosting package.

    Could anyone could point me in the right direction of what exactly I do with these files? Is it a simple case of linking them (the GZ file)in the head to the right place and letting the host do the rest?
     
  2. aLtikal

    aLtikal 1338-One step infront of the pro's

    Joined:
    7 May 2008
    Posts:
    943
    Likes Received:
    27
    Hmm I'm not sure how to answer your exact question but this might be of interest. I personally use .htaccess commands to compress my necessary files and let the web server handle it all. The commands I use are :

    Code:
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    This way I dont have to worry about zipping up any of my files because my web server does it.
     
  3. Ljs

    Ljs Modder

    Joined:
    4 Sep 2009
    Posts:
    2,220
    Likes Received:
    112
    Interesting, thanks. Guess I'll give this a go and see what happens!
     
  4. aLtikal

    aLtikal 1338-One step infront of the pro's

    Joined:
    7 May 2008
    Posts:
    943
    Likes Received:
    27
    Oh You'll have to check your get requests using something like Firebug to check if the http header is receiving the deflate commands though. It's on the "net" panel.
     
    Ljs likes this.
  5. Ljs

    Ljs Modder

    Joined:
    4 Sep 2009
    Posts:
    2,220
    Likes Received:
    112
    Worked perfectly, thanks. Much easier than pissing around with Gzip files!
     
  6. aLtikal

    aLtikal 1338-One step infront of the pro's

    Joined:
    7 May 2008
    Posts:
    943
    Likes Received:
    27
    Oh im glad i can help :)
     

Share This Page