I’ve set-up a repository on Google Code where you can download the code that generates the custom Ant task. Yes, I know it’s fashionable to create repositories on GitHub but I mostly use Subversion and Mercurial so there!
Alternatively you can check out the project directly by issuing the following command:
hg clone https://yui-compressor-ant-task.googlecode.com/hg/ yui-compressor-ant-task
Technically, it is possible to get the desired behaviour using Ant’s
apply would start to get ugly and (possibly) cumbersome. My Ant task is a bit neater. Well, I think so anyway.
Thought you might like to know about a similar project.
Hey, thanks for a wonderfully simple implementation 🙂 Implementing Ant tasks doesn’t seem that hard once you get down to it. I’ve even managed to convince the task to use the latest yuicompressor-2.4.8pre.jar (by setting the classpath in taskdef).
I did run into a some problems, which I decided to try and fix (instead of abandoning ship), so I cloned your project. I’ve addressed the following issues:
– Setting verbose=”true” would cause a NullPointerExcepction, because the ErrorReporter passed in was null
– Added failonerror to allow indication of whether or not the build should be considered failed if compressing fails. The default value is set to true, but I’m a little unsure as to what the “standard” default for this option is.
– And finally; since I foresee that we (in our project) want to minimise our CSS in some future, I’ve added in a ‘type’ attribute that accepts the values ‘js’, ‘css’ or ‘auto’. The first two are the types supported by YUI, the last I’ve added, because I can imagine that some people would maybe like to just gather all .js and .css files and have them minimised.
Would you be interested in any of these changes? Or, do you think someone elso would?
Thanks for your feedback.
I’d be interested in these changes. 🙂
I came across your ant library during one of my recent projects and found it to be almost what I wanted. However, I also required CSS minification and an option to delete original source files after minification (to do away with additional ant delete tasks in build.xml). So, I’ve modified the source of your library to add these features and hosted it on GitHub. I’ve posted the details in a blog post here:
I’ve taken care about the copyrights/license etc. In case you find something amiss, please let me know so that I can correct it.
I have added support for minifying CSS files.
Great utility – definitely helps using yui-compressor with Ant.
As an FYI – I was able to run it with the yuicompressor jar in the same classpathref, rather than using invoking ant with “-lib”.