#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Twinsburg, OH, USA
    Posts
    5
    Rep Power
    0
    Hi All,

    Planning to do a largish web project and I am looking at javscript to handle a good portion of it. I am assuming JS is transfered as text, like HTML, and not as byte codes, like java.

    if this is correct, I wondered if anyone knows of a utilty that would compress javascripts (removing extraneous spaces, tabs, etc). Ideally it would reduce size of user variable names/functions via subsitution.

    Thanks,
    Dave
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Cambridge MA, USA
    Posts
    2
    Rep Power
    0
    Dave,

    Check this website out. It will "crunch" the javascript by only removing the whitespace and comments. It doesn't try to rename variables.
    http://www.brainjar.com/js/crunch.html

    As an interesting side note, this particular javascript compressor is implemented in javascript.

    later,

    David E. West
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    51
    Rep Power
    14
    What might be a good idea is to keep all the Javascript codes on a js file so that the browser will only take the scripts it needs, it improves download time.
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Twinsburg, OH, USA
    Posts
    5
    Rep Power
    0
    Thanks for both pieces of advice.

    The script compressor seems to work pretty well on my JS code so far, so I am happy there.

    I may play with it some more and see about var/function compression. Maybe as an "add on" 2 passes, 1st build symobl table optimize names for size, 2nd then resubstitue them.

    Dave

Similar Threads

  1. compressing multiple files
    By Wraith in forum PHP Development
    Replies: 4
    Last Post: June 15th, 2004, 04:42 PM
  2. JavaScript's version of PHP's $_GET
    By JoshHarvill in forum JavaScript Development
    Replies: 0
    Last Post: January 29th, 2004, 07:46 PM
  3. Multiple JavaScripts in Form
    By techwreck in forum JavaScript Development
    Replies: 1
    Last Post: January 27th, 2004, 02:33 PM
  4. Replies: 4
    Last Post: January 27th, 2004, 12:10 PM
  5. Newbie needing a little help with some Javascripts
    By DeveloperNewbie in forum JavaScript Development
    Replies: 1
    Last Post: September 4th, 2003, 09:53 AM

IMN logo majestic logo threadwatch logo seochat tools logo