Compress all javascript files in a folder

 

I was looking into compressing JavaScript files and came across this JavaScript compressor by Dean Edwards. On the site he offers a .NET port by Jesse Hansen, which I have just ‘hacked’ to recursively duplicate a directory with the .js files compressed. I say ‘hacked’ as it was a bit of a rush job, but it seems to work. It also lets you put in a ‘header’ which allows you to put an author/copyright notice at the top of each of the compressed files. The dupicate folder is created in the same location as the orginal and named the same as the original with ‘_packed’ appended.

 

The original code is covered by a ‘GNU LGPL’ licence, so I’m posting my modifications here for anyone who might need or want them. I made my changes in Visual Studio 2008 so if you want to open the project you will need a copy (the free/express version should work fine). You will also need the .NET framework installed, I think the installer will prompt you to download it if you don’t already have it installed.

 

Download (source & installer): DirectoryPacker2.net.zip