YUI Compressor will be going through a deprecation process as the YUI team moves
to using a custom-wrapped UglifyJS for JavaScript compression and a more fully
updated and maintained version of CSSMin for CSS compression. This will allow
YUI to move beyond the limitations of the current YUI Compressor as well as take
advantage of the current state of the art in compression.

The new compression utilities are wrapped into a single node package called yuglify
and new issues can be filed against this project on GitHub.

So, let's convert the minify task we wrote to use yuglify
instead of the soon to be deprecated YUI Compressor.

The steps

We added the yui-compressor.jar to a tools folder in our scm. We can now remove that, we
will depend on yuglify being available on the PATH

yuglify is a node.js package, so to install it on our system we need to install
node.js. Note that it needs to be available on the target machine of
our deployment because that's where the minification will happen. (unless you're using the
local build option, more on that later)

Open a command prompt and install yuglify through npm

npm install -g yuglify

Now we can alter the task to use yuglify:

taskminify{# Invoke-Script, so this gets executed on the targetInvoke-Script{# Define a function, that can minify a folder that's under webfunctionMinify($folder,$type){Write-Host"Minifying folder $folder"-ForeGreenIf(-not$type){$type=$folder}# get all files inside the web folder and minify themForeach($filein(Get-ChildItem"$($config.releasepath)\web\$folder")){Write-Host"Minifying $file"# Wrap inside psake exec function so the build # fails if this operation failsExec{# get the file's content and pass it to yuglifyGet-Content$file.FullName`|yuglify--terminal--type$type`--output$file.FullName}}}# Now call the function for each folder we want to minimizeMinify"js"Minify"css"}}Set-AfterTaskreleaseminify

That's it

We're now ready for the future, using yuglify instead of the deprecated YUI Compressor.