You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Garrett Smith <dh...@gmail.com> on 2008/02/21 22:47:48 UTC

Who's Using YUI Compressor with ANT?

YUI Compressor does a pretty good job at minifying the JS.

I like the idea of building multiple files and doing batch operations.

I want to combine
a.js
b.js
c.js

to
abc-min.js

>From windows cmd:
C:\Users\ape\ant>.\bin\ant -buildfile=..\build.xml js.minify
Buildfile: ..\build.xml

js.minify:

BUILD SUCCESSFUL
Total time: 0 seconds
==============================
Cool! But where's my files?

build.xml:
<project>
<target name="js.minify">
    <apply executable="java" parallel="false">
        <fileset dir="aped\src" includes="APE.js, EventPublisher.js"/>
        <arg line="-jar"/>
        <arg path="yuicompressor-2.3.5\build\yuicompressor-2.3.5.jar"/>
        <srcfile/>
        <arg line="-o"/>
        <arg line="-v"/>
        <mapper type="glob" from="*.js" to="*-min.js"/>
        <targetfile/>
    </apply>
</target>
</project>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Who's Using YUI Compressor with ANT?

Posted by Garrett Smith <dh...@gmail.com>.
On Sun, Feb 24, 2008 at 10:37 PM,  <Ja...@rzf.fin-nrw.de> wrote:
> If you add a
>    taskname="yui"
>  to your <apply> task, you'll get better log statements ...
>  (I prefer having the executed command in the log - not just "exec" or "apply".)
>
Ok, Good to know.

Now I wan to add a build id/version to the rollups and non-rollups

Garrett

>  Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


AW: Who's Using YUI Compressor with ANT?

Posted by Ja...@rzf.fin-nrw.de.
If you add a
   taskname="yui"
to your <apply> task, you'll get better log statements ...
(I prefer having the executed command in the log - not just "exec" or "apply".)

Jan
 

> -----Ursprüngliche Nachricht-----
> Von: Yannick Haudry [mailto:yhaudry@gmail.com] 
> Gesendet: Freitag, 22. Februar 2008 10:50
> An: Ant Users List
> Betreff: Re: Who's Using YUI Compressor with ANT?
> 
> Hi,
> 
> Adding the 'dest' attribute to the Apply task and moving up the '-v'
> argument (as shown below) should make it work !
> 
> >  <target name="js.minify">
> >     <apply executable="java" parallel="false" dest="destDIR">
> >         <fileset dir="aped\src" includes="APE.js, 
> EventPublisher.js"/>
> >         <arg line="-jar"/>
> >         <arg 
> path="yuicompressor-2.3.5\build\yuicompressor-2.3.5.jar"/>
>            <arg line="-v"/>
> >         <srcfile/>
> >         <arg line="-o"/>
> >
> >         <mapper type="glob" from="*.js" to="*-min.js"/>
> >         <targetfile/>
> >     </apply>
> >  </target>
> 
> Yannick
> 
> 
> On Thu, Feb 21, 2008 at 10:47 PM, Garrett Smith 
> <dh...@gmail.com> wrote:
> > YUI Compressor does a pretty good job at minifying the JS.
> >
> >  I like the idea of building multiple files and doing batch 
> operations.
> >
> >  I want to combine
> >  a.js
> >  b.js
> >  c.js
> >
> >  to
> >  abc-min.js
> >
> >  From windows cmd:
> >  C:\Users\ape\ant>.\bin\ant -buildfile=..\build.xml js.minify
> >  Buildfile: ..\build.xml
> >
> >  js.minify:
> >
> >  BUILD SUCCESSFUL
> >  Total time: 0 seconds
> >  ==============================
> >  Cool! But where's my files?
> >
> >  build.xml:
> >  <project>
> >  <target name="js.minify">
> >     <apply executable="java" parallel="false">
> >         <fileset dir="aped\src" includes="APE.js, 
> EventPublisher.js"/>
> >         <arg line="-jar"/>
> >         <arg 
> path="yuicompressor-2.3.5\build\yuicompressor-2.3.5.jar"/>
> >         <srcfile/>
> >         <arg line="-o"/>
> >         <arg line="-v"/>
> >         <mapper type="glob" from="*.js" to="*-min.js"/>
> >         <targetfile/>
> >     </apply>
> >  </target>
> >  </project>
> >
> >  
> ---------------------------------------------------------------------
> >  To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> >  For additional commands, e-mail: user-help@ant.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Who's Using YUI Compressor with ANT?

Posted by Garrett Smith <dh...@gmail.com>.
On Sat, Feb 23, 2008 at 9:44 AM, Yannick Haudry <yh...@gmail.com> wrote:
> On Fri, Feb 22, 2008 at 10:06 PM, Garrett Smith <dh...@gmail.com> wrote:
>  > On 2/22/08, Yannick Haudry <yh...@gmail.com> wrote:
>  >  > Hi,
>  >  >
>  >  >  Adding the 'dest' attribute to the Apply task and moving up the '-v'
>  >  >  argument (as shown below) should make it work !
>  >
>  >  Thanks that worked great! Files are minified now.
>  >
>  >  docs:
>  >  http://ant.apache.org/manual/CoreTasks/apply.html
>  >
>  >  So I ran the whole thing on **/* and min'd them all. I also made a
>  >  <copy> command in a new target.
>  >
>  >  It's great. But I still want to figure a few more things out.
>  >
>  >  I want to build to files and combine them into one:
>  >   a.js
>  >   b.js
>  >
>  >  result:
>  >   a-b.js
>  >
>  >  How to do this?
>  >
>
>  Take a look at the Concat Task:
>  http://ant.apache.org/manual/CoreTasks/concat.html

Wow that was way easier than I thought it would be.

High level overview:
<target name="js.rollups">...</target>
<target name="js.copy" depends="js.rollups">...</target>
<target name="js.minify" depends="js.copy">...</target>
<target name="clean">...</target>

I just build all my js in 3 sec.

I'm surprised at how easy this was.

Thanks, Yannik.

Garrett

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Who's Using YUI Compressor with ANT?

Posted by Yannick Haudry <yh...@gmail.com>.
On Fri, Feb 22, 2008 at 10:06 PM, Garrett Smith <dh...@gmail.com> wrote:
> On 2/22/08, Yannick Haudry <yh...@gmail.com> wrote:
>  > Hi,
>  >
>  >  Adding the 'dest' attribute to the Apply task and moving up the '-v'
>  >  argument (as shown below) should make it work !
>
>  Thanks that worked great! Files are minified now.
>
>  docs:
>  http://ant.apache.org/manual/CoreTasks/apply.html
>
>  So I ran the whole thing on **/* and min'd them all. I also made a
>  <copy> command in a new target.
>
>  It's great. But I still want to figure a few more things out.
>
>  I want to build to files and combine them into one:
>   a.js
>   b.js
>
>  result:
>   a-b.js
>
>  How to do this?
>

Take a look at the Concat Task:
http://ant.apache.org/manual/CoreTasks/concat.html


>  Garrett
>
>
>
>
>  > Yannick
>  >
>  >
>  >
>  >  On Thu, Feb 21, 2008 at 10:47 PM, Garrett Smith <dh...@gmail.com> wrote:
>  >  > YUI Compressor does a pretty good job at minifying the JS.
>  >  >
>  >  >  I like the idea of building multiple files and doing batch operations.
>  >  >
>  >  >  I want to combine
>  >  >  a.js
>  >  >  b.js
>  >  >  c.js
>  >  >
>  >  >  to
>  >  >  abc-min.js
>  >  >
>  >  >  From windows cmd:
>  >  >  C:\Users\ape\ant>.\bin\ant -buildfile=..\build.xml js.minify
>  >  >  Buildfile: ..\build.xml
>  >  >
>  >  >  js.minify:
>  >  >
>  >  >  BUILD SUCCESSFUL
>  >  >  Total time: 0 seconds
>  >  >  ==============================
>  >  >  Cool! But where's my files?
>  >  >
>  >  >  build.xml:
>  >  >  <project>
>  >  >  <target name="js.minify">
>  >  >     <apply executable="java" parallel="false">
>  >  >         <fileset dir="aped\src" includes="APE.js, EventPublisher.js"/>
>  >  >         <arg line="-jar"/>
>  >  >         <arg path="yuicompressor-2.3.5\build\yuicompressor-2.3.5.jar"/>
>  >  >         <srcfile/>
>  >  >         <arg line="-o"/>
>  >  >         <arg line="-v"/>
>  >  >         <mapper type="glob" from="*.js" to="*-min.js"/>
>  >  >         <targetfile/>
>  >  >     </apply>
>  >  >  </target>
>  >  >  </project>
>  >  >
>  >
>  > >  ---------------------------------------------------------------------
>  >  >  To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>  >  >  For additional commands, e-mail: user-help@ant.apache.org
>  >  >
>  >  >
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>  >  For additional commands, e-mail: user-help@ant.apache.org
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>  For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Who's Using YUI Compressor with ANT?

Posted by Garrett Smith <dh...@gmail.com>.
On 2/22/08, Yannick Haudry <yh...@gmail.com> wrote:
> Hi,
>
>  Adding the 'dest' attribute to the Apply task and moving up the '-v'
>  argument (as shown below) should make it work !

Thanks that worked great! Files are minified now.

docs:
http://ant.apache.org/manual/CoreTasks/apply.html

So I ran the whole thing on **/* and min'd them all. I also made a
<copy> command in a new target.

It's great. But I still want to figure a few more things out.

I want to build to files and combine them into one:
  a.js
  b.js

result:
  a-b.js

How to do this?

Garrett


> Yannick
>
>
>
>  On Thu, Feb 21, 2008 at 10:47 PM, Garrett Smith <dh...@gmail.com> wrote:
>  > YUI Compressor does a pretty good job at minifying the JS.
>  >
>  >  I like the idea of building multiple files and doing batch operations.
>  >
>  >  I want to combine
>  >  a.js
>  >  b.js
>  >  c.js
>  >
>  >  to
>  >  abc-min.js
>  >
>  >  From windows cmd:
>  >  C:\Users\ape\ant>.\bin\ant -buildfile=..\build.xml js.minify
>  >  Buildfile: ..\build.xml
>  >
>  >  js.minify:
>  >
>  >  BUILD SUCCESSFUL
>  >  Total time: 0 seconds
>  >  ==============================
>  >  Cool! But where's my files?
>  >
>  >  build.xml:
>  >  <project>
>  >  <target name="js.minify">
>  >     <apply executable="java" parallel="false">
>  >         <fileset dir="aped\src" includes="APE.js, EventPublisher.js"/>
>  >         <arg line="-jar"/>
>  >         <arg path="yuicompressor-2.3.5\build\yuicompressor-2.3.5.jar"/>
>  >         <srcfile/>
>  >         <arg line="-o"/>
>  >         <arg line="-v"/>
>  >         <mapper type="glob" from="*.js" to="*-min.js"/>
>  >         <targetfile/>
>  >     </apply>
>  >  </target>
>  >  </project>
>  >
>
> >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>  >  For additional commands, e-mail: user-help@ant.apache.org
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>  For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Who's Using YUI Compressor with ANT?

Posted by Yannick Haudry <yh...@gmail.com>.
Hi,

Adding the 'dest' attribute to the Apply task and moving up the '-v'
argument (as shown below) should make it work !

>  <target name="js.minify">
>     <apply executable="java" parallel="false" dest="destDIR">
>         <fileset dir="aped\src" includes="APE.js, EventPublisher.js"/>
>         <arg line="-jar"/>
>         <arg path="yuicompressor-2.3.5\build\yuicompressor-2.3.5.jar"/>
           <arg line="-v"/>
>         <srcfile/>
>         <arg line="-o"/>
>
>         <mapper type="glob" from="*.js" to="*-min.js"/>
>         <targetfile/>
>     </apply>
>  </target>

Yannick


On Thu, Feb 21, 2008 at 10:47 PM, Garrett Smith <dh...@gmail.com> wrote:
> YUI Compressor does a pretty good job at minifying the JS.
>
>  I like the idea of building multiple files and doing batch operations.
>
>  I want to combine
>  a.js
>  b.js
>  c.js
>
>  to
>  abc-min.js
>
>  From windows cmd:
>  C:\Users\ape\ant>.\bin\ant -buildfile=..\build.xml js.minify
>  Buildfile: ..\build.xml
>
>  js.minify:
>
>  BUILD SUCCESSFUL
>  Total time: 0 seconds
>  ==============================
>  Cool! But where's my files?
>
>  build.xml:
>  <project>
>  <target name="js.minify">
>     <apply executable="java" parallel="false">
>         <fileset dir="aped\src" includes="APE.js, EventPublisher.js"/>
>         <arg line="-jar"/>
>         <arg path="yuicompressor-2.3.5\build\yuicompressor-2.3.5.jar"/>
>         <srcfile/>
>         <arg line="-o"/>
>         <arg line="-v"/>
>         <mapper type="glob" from="*.js" to="*-min.js"/>
>         <targetfile/>
>     </apply>
>  </target>
>  </project>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>  For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org