AutoWhack

AutoWhack is a small GUI application that wraps up the YUI Compressor and can be used to automate the compression of a number of Javascript/CSS files for production websites.

Why would I use it?

The YUI Compressor is an excellent little Javascript and CSS compressor, but using it from the command-line every time you want to do some compression can be a chore.  Some build systems such as the YUI Maven plugin can automate the process, but in others (such as .NET solutions, or just standalone no-build projects) this is more difficult, so this is where AutoWhack can lend a hand.

How does it work?

AutoWhack will take a directory, and on your command, recursively find all the Javascript/CSS files in it, concatenate them together into one long file, and then compress the result.  It can also do this automatically at a specified interval if you’re actively working on the source and you want to keep your packed version up-to-date.

Updates:

Version 0.4 (10/08/2010)

  • CSS Support – now you can crush CSS files as easily as your JS ones.
  • Now remembers your settings from last time you launched – no clicking all the way down through every time you want to work on the same project again.
  • Known issue: Command-line options may not work correctly (use 0.3 instead) – testing here has been minimal.
  • Known issue: Closing the AutoWhack window exits the application rather than minimizing to system tray.  Will be fixed in next release.

Usage:

GUI (default):

Download the JAR, and assuming you’ve got Java installed, double-click the downloaded file.  Select a directory where your uncompressed Javascript source sits and an output file for the packed version, and you’re set.  Click “Compress Now” to instantly compress your Javascript, or click “Start” to monitor your source directory at the interval specified.

If you close the window, AutoWhack will continue to run and sit in your system tray out of the way.  To exit AutoWhack, right-click the system tray icon and select “Exit AutoWhack”.

Command-line:

Download the JAR as before, but run the following command (or similar) to run the JAR:

java -jar AutoWhack-0.3-win32.jar --no-ui

You’ll get a list of command-line options that you can use:

usage: autowhack
 -a,--absolute          Use absolute path to root directory
 -d,--directory <arg>   Root directory
 -e,--extension <arg>   File extension to filter upon
 -i,--interval <arg>    Check interval (in milliseconds)
 -n,--no-ui             Don't show a GUI
 -o,--output <arg>      Output file

Warning: These command-line options might not work that well as they haven’t had much love in recent weeks.  Any problems, leave them in the comments.

Download:

JAR File for Windows (0.3) - Right-click, “Save Target As…”, and then double-click to run

JAR File for Windows (0.4 beta) - Right-click, “Save Target As…”, and then double-click to run