Free JavaScript compressor available online

Tweet

(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.

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

  • 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>