Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Last active December 12, 2015 09:19
Show Gist options
  • Save miguelmota/4750373 to your computer and use it in GitHub Desktop.
Save miguelmota/4750373 to your computer and use it in GitHub Desktop.
Ant build to compress HTML files recursively using htmlcompressor-1.5.3.jar. Blog post: http://www.miguelmota.com/blog/ant-task-to-compress-html-files/
<?xml version="1.0" encoding="UTF-8"?>
<project default="compress-html">
<target name="compress-html">
<apply executable="java">
<fileset dir="src" includes="**/*.html"/>
<arg value="-jar"/>
<arg path="lib/htmlcompressor-1.5.3.jar"/>
<arg line="-t html"/>
<srcfile/>
<arg value="-o"/>
<mapper type="glob" from="*" to="compressed/*"/>
<targetfile/>
</apply>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment