Re: Using Ant to Minify Javascript and CSS
Re: Using Ant to Minify Javascript and CSS
- Subject: Re: Using Ant to Minify Javascript and CSS
- From: John Huss <email@hidden>
- Date: Mon, 9 Mar 2009 14:51:01 -0500
Ask and you shall receive, seek and you shall find, knock and it will be opened to you.
I use
YUICompressor. This will minify the js and css files in the ${dest.dir} location after the ant build (not the original files obviously). The mapper here doesn't actually change the filename - the files are minified in place. This is from the pre-hotness build.xml BTW.
John
<target name="js.minify" depends="build.woapp">
<apply executable="java" parallel="false" force="true" dest="${dest.dir}/${
project.name}.woa/Contents/WebServerResources">
<fileset dir="WebServerResources" includes="**/*.js"/>
<arg line="-jar"/>
<arg path="../MySharedFramework/Libraries/yuicompressor-2.3.5.jar"/>
<srcfile/>
<arg line="-o"/>
<mapper type="identity" from="*.js" to="*-min.js"/>
<targetfile/>
</apply>
</target>
<target name="css.minify" depends="build.woapp">
<apply executable="java" parallel="false" force="true" dest="${dest.dir}/${
project.name}.woa/Contents/WebServerResources">
<fileset dir="WebServerResources" includes="**/*.css"/>
<arg line="-jar"/>
<arg path="../MySharedFramework/Libraries/yuicompressor-2.3.5.jar"/>
<arg line="--line-break 0"/>
<srcfile/>
<arg line="-o"/>
<mapper type="identity" from="*.css" to="*-min.css"/>
<targetfile/>
</apply>
</target>
On Mon, Mar 9, 2009 at 2:33 PM, Kevin Hinkson
<email@hidden> wrote:
Hi,
I've never done any scripting via Ant but I get the vague impression that I should be able to trigger a call to minify any _javascript_ or CSS files being built in a WebObjects Eclipse project. Does anyone have any experience doing this or could maybe recommend a good Ant tutorial for me?
Thanks.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden