Apache Ant

Apache Ant

[2011-08-24] OSX comes with ant

[2011-08-27] 一份简单的构建文件(build.xml)

1
2
3
4
5
6
<?xml version="1.0" ?>
<project name="ant-hello-world" default="init" basedir=".">
<target name="init">
<echo>Hello World!</echo>
</target>
<project>

[2011-09-15]合并文件 - Task concat

1
2
3
4
5
6
7
8
<target name="js-concat">
<concat destfile="${web.dir}/js/script.js" encoding="UTF-8">
<header trimleading="yes">(function(){ </header>
<filelist dir="${web.dir}/js"
files="jquery.js, form.js, animate.js, analytics.js" />
<footer>})();</footer>
</concat>
</target>

[2011-09-15]JsLint (Jslint4java)

1
2
3
4
5
6
7
8
9
10
11
<!--JSLint-->
<taskdef name="jslint"
classname="com.googlecode.jslint4java.ant.JSLintTask"
classpath="${lib.dir}/jslint4java-2.0.0.jar" />
<target name="js-lint">
<jslint>
<formatter type="plain" />
<fileset dir="${web.dir}/js"
includes="form.js, animate.js" />
</jslint>
</target>

[2011-09-16]Compress JS Using Google Compiler Closure

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!--Compress JS Using Google Compiler Closure-->
<target name="JS-Compress">
<property name="google.compressor" value="${lib.dir}/compiler.jar" />
<apply executable="java" dest="${web.dir}/js">
<fileset dir="${web.dir}/js" includes="think.js" />
<arg line="-jar" />
<arg path="${google.compressor}" />
<arg line="--js" />
<srcfile />
<arg line="--js_output_file" />
<mapper type="glob" from="*.js" to="*-min.js" />
<targetfile />
</apply>
</target>
0%