On 14/03/2012, at 3:29 AM, Johann Werner wrote:

> to minify js and css add this to your build.xml:
> 
> <target name="minify" if="yuicompress.available">
>       <echo message="Minification of CSS files." />
> 
>       <apply executable="java" dir="${dest.dir}" relative="true">
>               <fileset dir="${dest.dir}" 
> includes="**/WebServerResources/**/*.css"/>
>               <arg line="-jar"/>
>               <arg path="${yuicompress.jar}"/>
>               <srcfile/>
>               <arg line="--charset"/>
>               <arg value="utf-8"/>
>               <arg line="-o"/>
>               <targetfile/>
>               <mapper type="identity"/>
>       </apply>
>       <replace dir="${dest.dir}" includes="**/WebServerResources/**/*.css" 
> token=";}" value="}"/>
> 
>       <echo message="Minification of JS files." />
> 
>       <apply executable="java" dir="${dest.dir}" relative="true">
>               <fileset dir="${dest.dir}" 
> includes="**/WebServerResources/**/*.js"/>
>               <arg line="-jar"/>
>               <arg path="${yuicompress.jar}"/>
>               <srcfile/>
>               <arg line="--charset"/>
>               <arg value="utf-8"/>
>               <arg line="-o"/>
>               <targetfile/>
>               <mapper type="identity"/>
>       </apply>
> </target>

We do something quite similar, though for historical reasons we use 
'JSMin_Task' for Javascript, based on Douglas Crockford's JSMin code.

        <!-- Taskdef for JSMin, a task based on Douglas Crockford's code -->
        <taskdef name="jsmin" classname="net.matthaynes.jsmin.JSMin_Task" />
        ...
        <!-- Minify JS -->
        <jsmin suffix="false" force="true" copyright="Copyright (C) 2008-2011 
Logic Squad">
                <fileset 
dir="${dest.dir}/${project.name}.woa/Contents/WebServerResources/" 
includes="**/*.js" />
        </jsmin> 

http://code.google.com/p/jsmin-ant-task/

Requires jsmin.jar on the classpath at build time, obviously.


-- 
Paul.

http://logicsquad.net/


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to