Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Ant target for gzipping multiple files
<target name="compress">
<!-- store filenames in a property delimited by ; -->
<pathconvert pathsep=";" property="compress.jsfiles">
<fileset dir="${build.dir}" includes="*.js"/>
<script language="javascript"><![CDATA[
//get the property and convert to an array
var files = project.getProperty("compress.jsfiles").split(";"),
for (i=0, len=files.length; i < len; i++) {
//create new gzip task
gzip = project.createTask("gzip");
gzip.setSrc(new File(files[i]));
gzip.setDestfile(new File(files[i].replace(".js", ".js.gz")));
]]> </script>

This comment has been minimized.

Show comment Hide comment

greenkiwi Dec 16, 2014

Thank you very much. This was extremely helpful

Thank you very much. This was extremely helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment