Recent Changes - Search:

edit SideBar



Another task we will eventually have to confront is to somehow automatically provide minimized versions of the .js files. Perhaps we could automatically create a file Foo_min.js for each Foo.js?



Ant for YUICompressor looks useful. Here's how to build it:

git clone
cd ant-yui-compressor/
(cd lib;wget
ant package

This produces dist/ant-yui-compressor-taskdef-1.0.jar, which needs to be copied to the ant lib directory:

bash-3.2$ which ant
bash-3.2$ ls -l /opt/local/bin/ant
lrwxr-xr-x  1 root  admin  32 Nov 23 08:15 /opt/local/bin/ant -> ../share/java/apache-ant/bin/ant
bash-3.2$ ls /opt/local/share/java/apache-ant/
CONTRIBUTORS            etc                     lib
bin                     fetch.xml               patch.xml
contributors.xml        get-m2.xml
bash-3.2$ sudo cp ~cxh/src/ant-yui-compressor/dist/ant-yui-compressor-taskdef-1.0.jar /opt/local/share/java/apache-ant/lib/

See for how to use this.

The disadvantage here is that we need to install this for ant to work.

A better solution would be something that does not require modifying the local ant installation.

Simple use of Ant and YUI Compressor

We could add a rule that would download yuicompressor and then use this rule:

<target name="compress" description="compress the JS files">
    <copy todir="temp/js" overwrite="yes">
        <fileset dir="original/js"/>
    <apply executable="java" parallel="false" dest="temp/js">
        <fileset dir="temp/js" includes="**/*.js" />
          <arg line="-jar"/>
          <arg path="test_lib/yuicompressor-2.4.8.jar" />
          <arg line="-v"/>
          <arg line="-o"/>
          <mapper type="glob" from="*.js" to="*-min.js"/>
    <move todir="original/js" overwrite="true">
        <fileset dir="temp/js" />
        <mapper type="glob" from="*-min.js" to="*.js"/>
Edit - History - Print - Recent Changes - Search
Page last modified on January 08, 2016, at 04:32 PM