The WordPress tool I’m developing uses jQuery scripting. I’ve seen people including a minimized version of the scripting and I think that’s a good approach. I’m using Eclipse on Windows on my development system and it happened more than once that I forgot to include the minimized version of the scripting. I found a solution in my search for a way to do this automatically.
<name>.dev.js, the minimized output is written to
Here’s the content of the batch file I’m using. You’re free to use it at your own risk. Be careful though as it may damage your scripting. Replace the dots by the name of the Ajax Minifier installation directory.
@echo off set inputfile=%1 set outputfile=%inputfile:.dev=% if not %inputfile% == %outputfile% ( "...Microsoft\Microsoft Ajax Minifier 4\AjaxMin.exe" -clobber:true %inputfile% -o %outputfile% )
It’s not entirely full-proof. Eclipse will complain about the resource being out of sync and needing refresh. I’ll update this post when I find a way around that.
Update: There’s an easy way around eclipse complaining about the resource needing a refresh. Check “Refresh resources upon completion” from the “Refresh” tab, and select “The folder containing the selected resource”. Don’t forget to save the settings.