(Via Ajaxian) The Dojo Toolkit is one of the biggest JavaScript libraries out there, weighing in at about 4MBover 250KB of JavaScript code as written. That’s why the makers of the toolkit developed a JavaScript compressor to reduce the library to a reasonable size for use on real-world Websites. This compressor has the advantage over several others out there that it actually parses the JavaScript code it is compressing–using the Mozilla Rhino JavaScript parser–rather than simply relying on a set of regular expressions to make a best guess as to what parts of the code may be compressed safely.

Now that same compressor is available online through a convenient Web form, called ShrinkSafe. It lets you upload one or more JavaScript files, and it will give you back a single, compressed JavaScript file for you to use on your site.

Kevin began developing for the Web in 1995 and is a highly respected technical author. Kev is a world-renowned author, speaker and JavaScript expert. He has a passion for making web technology easy to understand by anyone. Yes, even you!

Free Guide:

How to Choose the Right Charting Library for Your Application

How do you make sure that the charting library you choose has everything you need? Sign up to receive this detailed guide from FusionCharts, which explores all the factors you need to consider before making the decision.


  • Alex Russell

    If we’ve got 4 meg of JS code, I’ll eat my (infrequently worn) hat. Before “compression”, our kitchen-sink build weighs in at 260K, and most builds we ship are eventually

  • http://www.sitepoint.com/ Kevin Yank

    Alex, sorry about that. The 4MB figure was taken from Tim Lucas’s presentation on AJAX at Web Essentials 2005 a few weeks ago. Perhaps he was being facetious, but the 4MB figure seemed oddly specific, so I took him at his word.

  • Alex Russell

    No problem. I’ll shoot him an email and hopefully we can nip a wild number like that in the bud.

  • Vindberg

    Hi, I also found the ShrinkSafe compressor useful. If you use it in combination with Dean Edwards compressor engine the result is even smaller js files.

    I did exactly so with the Prototype library. You can use the javascript compressor at javascriptcompressor.com and also download the compressed prototype library – its only 21KB compared to its original 49KB.

  • Pingback: SitePoint Blogs » OSCON 2006: Ajax Optimization Techniques()

  • Anonymous

    script language=”JavaScript”>
    function fn_validateNumeric(thi,dec)
    {
    if (((event.keyCode 57)) && (event.keyCode != 46))
    event.returnValue = false;
    if(dec==”n” && event.keyCode == 46)
    {
    event.returnValue = false;
    }
    else
    {
    if(event.keyCode == 46 && instr(thi.value,”.”)>=0)
    event.returnValue = false;
    }
    }

  • Anonymous

    gfdgfgfdfdgfdg</code>

Special Offer
Free course!

Git into it! Bonus course Introduction to Git is yours when you take up a free 14 day SitePoint Premium trial.