So, after some research, I decided to use excellent YUI Compressor (found here), and utilizing a few Windows Batch commands I picked up here and there, I created a .BAT file:
echo off set buildFile=../www/js-lib/app-deploy/final-build-file.js set libDir=../html/js-lib set yuiComp=./yuicompressor-2.4.2/build/yuicompressor-2.3.5.jar FOR %%G IN (file1.js file2.js directory/file3.js) DO ( echo on Echo Compressing %%G... echo off java -jar %yuiComp% --preserve-semi --line-break 100 %libDir%/%%G >> %buildFile% )
Simply change the directories and file names to what you need (I trust you can figure this out), stick all that into a .BAT file, and then run it from your Windows command line -- it'll create a nice combined javascript source file at the location of "%buildFile%".
Issues: You'll need to delete the older build file whenever you run the batch command each time -- I couldn't find a way to delete a file on the server I was working with (using Windows batch commands), and if you run this batch file without deleting the older build file it creates first, it'll simply append your new build file onto the end of the old one!
Links:
BATCH FILE COMMANDS: Simple programming commands in a batch environment
Introduction to the Windows Command Prompt
MS DOS Copy Command Help
Have you tried out JSBuilder2 off the Ext site? pretty cool utility uses a json file (jsb2) and will let you set up one or many output files along with the Ext style compressed/debug versions.
ReplyDeleteNope, but it looks pretty good -- will probably start using it for the next build I do. TBH, this post was a draft that I made nearly two years ago, and have just gotten around to posting!
ReplyDelete