EXTjs 文件压缩

之前曾使用过的办法有gzip(我记性不是很好,就是放在IIS中用以压缩页面代码的工具,具体名字记得不是很清楚,如果您比较清楚,请指正,互相学习)、和YUIcompressor等压缩js代码工具。



请进这个页面 http://mootools.net/download 下载那个 YUI Compressor 了吗,才65K 下来后发现 文件夹里面:

build-+

      -yuicompressor-2.4.2.jar

doc--+

      -CHANGELOG -README

lib--+

      -jargs-1.0.jar

      -rhino-1.6R7.jar

src--+

      -com--+

           - ...

      -org--+

            -...

ant.properties

build.xml

再看看build.xml里面写了些什么:

<?xml version="1.0" encoding="iso-8859-1"?>
<project name="YUI Compressor" default="build.jar" basedir=".">

    <target name="clean" depends="-load.properties">
        <delete dir="${build.dir}" quiet="true"/>
    </target>

    <target name="-load.properties">
        <property file="ant.properties"/>
    </target>

    <target name="-init" depends="-load.properties">
        <mkdir dir="${build.dir}"/>
    </target>

    <target name="build.classes" depends="-init">
        <mkdir dir="${build.dir}/classes"/>
        <javac srcdir="${src.dir}"
               destdir="${build.dir}/classes"
               includes="**/*.java"
               deprecation="off"
               debug="on"
               source="1.4">
            <classpath>
                <pathelement location="${lib.dir}/jargs-1.0.jar"/>
                <pathelement location="${lib.dir}/rhino-1.6R7.jar"/>
            </classpath>
        </javac>
    </target>

    <target name="build.jar" depends="build.classes">
        <mkdir dir="${build.dir}/jar"/>
        <!-- The order is important here. Rhino MUST be unjarred first!
             (some of our own classes will override the Rhino classes) -->
        <unjar src="${lib.dir}/jargs-1.0.jar" dest="${build.dir}/jar"/>
        <unjar src="${lib.dir}/rhino-1.6R7.jar" dest="${build.dir}/jar"/>
        <copy todir="${build.dir}/jar">
            <fileset dir="${build.dir}/classes" includes="**/*.class"/>
        </copy>
        <jar destfile="${build.dir}/${jar.name}" basedir="${build.dir}/jar">
            <manifest>
                <attribute name="Main-Class" value="com.yahoo.platform.yui.compressor.Bootstrap"/>
            </manifest>
        </jar>
    </target>

    <target name="build.dist.package" depends="build.jar">
        <mkdir dir="${build.dir}/${dist.package.name}"/>
        <mkdir dir="${build.dir}/${dist.package.name}/build"/>
        <copy file="${build.dir}/${jar.name}" todir="${build.dir}/${dist.package.name}/build"/>
        <copy todir="${build.dir}/${dist.package.name}">
            <fileset dir=".">
                <include name="ant.properties"/>
                <include name="build.xml"/>
                <include name="doc/**/*"/>
                <include name="lib/**/*"/>
                <include name="src/**/*"/>
                <exclude name="**/CVS"/>
            </fileset>
        </copy>
        <zip destfile="${build.dir}/${dist.package.name}.zip"
             basedir="${build.dir}"
             includes="${dist.package.name}/**/*"/>
    </target>

</project>

你可能感兴趣的:(xml,ant,yui,IIS,mootools)