Is it ok to compress Javascript Files

Discussion in 'JavaScript' started by Mr Happy, Nov 19, 2009.

  1. #1
    Was browsing the SEO area and came across a tool which told me to compress my javascript files for faster loading.

    Did a quick search and found this http://dean.edwards.name/packer/ and it seams to work.

    Now the thing is the add-this social bookmark javascript was compressed but jquery isn't. Is their any reason it or any javascript shouldn't be compressed and if not what compressor tools would you recomend.

    No my site doesn't have a lot of javascript on it and this won't have any major affect on load speed. I'm just being curious.
     
    Last edited: Nov 19, 2009
    Mr Happy, Nov 19, 2009 IP
  2. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #2
    erm - dont use dean edwards. this is an EVAL based packer - which is now considered "evil" as a lot of nasty stuff gets released using it as a means to obtuse code. the fact that it performs an eval is also an unnecessary risk at allowing XSS attacks, imo.

    read this:
    http://www.dynamoo.com/blog/2008/09/asprox-evalfunctionpacker.html

    a lot of the big players like jquery, mootools etc (js frameworks) that used to use it got done by the anti virus blockage on all scripts packed this way. as a result, frameworks now tend to use YUI - http://www.julienlecomte.net/yuicompressor/ or JSmin - http://javascript.crockford.com/jsmin.html

    additionally, you can enable clientside gzip compression on all your js/css files anyway and it beats dean's easily.

    for the best analytical tool for page performance, use YSLOW - its a firebug plugin for firefox. it will break down all site components and assign them scores, as well as give you recommendations on how to improve things in accordance with what is considered to be today's best practices.
     
    dimitar christoff, Nov 19, 2009 IP
  3. Mr Happy

    Mr Happy Greenhorn

    Messages:
    48
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    20
    #3
    Cool dimitar christoff, thanks for the warning and advice about dean edwards. I'll just use the clientside gzip as suggested so.
     
    Mr Happy, Nov 19, 2009 IP