Skip to content

Instantly share code, notes, and snippets.

@zefer
Created September 28, 2010 14:23
Show Gist options
  • Save zefer/601073 to your computer and use it in GitHub Desktop.
Save zefer/601073 to your computer and use it in GitHub Desktop.
<?xml version="1.0"?>
<project basedir="." default="build">
<taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask" classpath="lib/compiler.jar"/>
<target name="build" depends="combineJs">
</target>
<target name="combineJs">
<!-- combine the javascript into a single uncompressed file -->
<concat destfile="../js/all.js">
<filelist dir="../js">
<file name="file1.js"/>
<file name="file2.js"/>
<file name="file3.js"/>
</filelist>
</concat>
<echo message="concatenated js > all.js."/>
<!-- compile/compress using Google Closure -->
<jscomp compilationLevel="simple" warning="quiet" debug="false" output="../js/all.min.js">
<sources dir="../js">
<file name="all.js" />
</sources>
</jscomp>
<echo message="minified js > all.min.js."/>
<copy file="../index.dev.html" tofile="../index.html" overwrite="true" />
<replaceregexp file="../index.html" match="&lt;\!-- \[start combine\].*\[end combine\] --&gt;" replace="&lt;script type=&quot;text/javascript&quot; src=&quot;js/all.min.js&quot;&gt;&lt;/script&gt;" flags="s" />
<echo message="created index.html using minified js."/>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment