Skip to content

Instantly share code, notes, and snippets.

@jineeshjohn
Created July 17, 2013 13:40
Show Gist options
  • Save jineeshjohn/6020639 to your computer and use it in GitHub Desktop.
Save jineeshjohn/6020639 to your computer and use it in GitHub Desktop.
Ant script to merge multiple files with a custom separator
<project default="theMerger" basedir=".">
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<target name="theloop">
<foreach target="theSeparator" param="theFile">
<path id="someId">
<fileset dir="${basedir}/dd" includes="**/*.js"/>
</path>
</foreach>
</target>
<target name="theSeparator">
<sequential>
<echo append="true" file="${theFile}">
<![CDATA[
/*
* @CompanyName Copyright(c)
* ${theFile}
*/
]]>
</echo>
</sequential>
</target>
<target name="theMerger" depends="theloop">
<concat destfile="dd/min.js" fixlastline="true" append="true">
<fileset id="files" dir="${basedir}/dd" includes="**/*.js" />
</concat>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment