YUI Compressor for NAnt
I had my first go with NAnt just a few hours ago and it was so easy, I am already porting my batch scripts over and creating build scripts with a few good examples off the web as my starting point.
I came across the JSMin task for NAnt which was pretty good but not as good as YUI Compressor. I came across a .NET C# port of the JAVA based YUI Compressor and also found a custom task for it but no DLL. I threw the two together with the latest .NET port of YUI Compressor and put it up on my projects for download under NAnt task for YUI Compressor.
Save yourself the headache and drop NAnt for Rake or psake.
I considered only MSBuild and NAnt for my purposes. Even though I’ve had rails envy lately, Ruby and Python are both a little out of reach due to the learning curve plus it would unnecessarily complicate my build files beyond the current XML. Beyond minifying and coalescing some files, I don’t need much else for now. Maybe Cruise Control a few months down which should integrate nicely with NAnt. Also, writing extensions for NAnt is really easy.
Everything else is in good old batch files =)
eww, don’t punish yourself, at least take a look at hudson: http://stackoverflow.com/questions/582687/ci-hudson-with-net-vs-cruisecontrol-net
Certainly going to consider it, I have seen it come up in a few places with good reviews. But CI is a distant thought for now. I have enough shiny new toys to keep me busy for some time!
I recently wrote a blog about how to do this without any custom tasks. I uses Nants contrib <concat> task to concat all of the files i wanted compressed into a single file, and an exec call to the yui-compressor jar file to compress the resulting file, which acheived the same result as this task (but not as pretty). However, I found one issue though which pertains to concatenating the files. When using the concat tasks, the files in the fileset are not concatenated in order, which could cause problems for some of my scripts (I suppose I could have removed those from the fileset and just included in the page as normal).
I checked the code for the concat task and it wasn’t doing anything special with the fileset, just iterating over it just as the yuicompressor task does, which leads me to believe it will have the same problem. I solved the problem by using the asis attribute for each <include> file in the fileset.
See my blog here: http://wolfewebservices.com/blog/using-nant-yahoo-yui-javascript-compressor for more info
I know this is an old thread, but there’s been a .NET port of YUI Compressor for a while :- http://www.codeplex.com/YUICompressor
maybe the DLL and/or MSBuild Task that comes with that, u might find useful?
GL 🙂