This is a registry/bat extension that allows you to right-click a folder in Windows explorer (tested on XP) and it will delete all of the *-min.js and *-min.css files and then recreate them using YUI Compressor. After installing, right-click a folder and choose "Compress JS/CSS Files".
Don't use this on a folder that has a bunch of already -min(ified) js and css files and you don't also have the uncompressed files. This will first delete the -min file if it exists and then recreate it using the filename without the -min. I wrote this as a useful function for something I do over and over. I always use the uncompressed files for development but reference the -min files in production. This will recreate them for you easily.
To install just copy all of the files to C:\winnt\ and run yuicompressor.reg. If you want to put the files anywhere else then you'll have to change the paths in both the bat and reg files. My suggestion is just to create this folder if it doesn't exist and keep it simple.
If you want to upgrade the YUI Compressor binary just download it and remove the version number from the filename so that it's simply "yuicompressor.jar" and dump it in c:\winnt and you're ready to go.
Download yuicompressor.zip
Here's the code for the bat file:
cd "%1"
for /f %%a in ('dir /b *-min.js') do call:ProcessDel: %%a
for /f %%a in ('dir /b *-min.css') do call:ProcessDel: %%a
for /f %%a in ('dir /b *.js') do call:ProcessCompress: %%a
for /f %%a in ('dir /b *.css') do call:ProcessCompress: %%a
:ProcessDel
IF NOT [%1]==[] call:DeleteMinFiles: %1
GOTO:EOF
:ProcessCompress
IF NOT [%1]==[] call:CompressFiles: %1
GOTO:EOF
:DeleteMinFiles
IF EXIST "%CD%\%1" del "%CD%\%1"
GOTO:EOF
:CompressFiles
java -jar c:\winnt\yuicompressor.jar %1 -o %~n1-min%~x1
GOTO:EOF |