Skip to content

Instantly share code, notes, and snippets.

@philmander
Created September 5, 2011 20:55
Show Gist options
  • Save philmander/1195897 to your computer and use it in GitHub Desktop.
Save philmander/1195897 to your computer and use it in GitHub Desktop.
Data URIs and automation with CSSEmbed and Ant 1
<?xml version="1.0"?>
<project default="cssDataUriEmbed" basedir="." xmlns:ca="antlib:net.sourceforge.clearantlib">
<property name="build.dir" location="${basedir}/build" />
<property name="websrc.dir" location="${basedir}/WebContent" />
<taskdef name="cssurlembed" classname="net.nczonline.web.cssembed.CSSEmbedAntTask" >
<classpath>
<fileset dir="${basedir}/lib" includes="cssembed-0.3.3.jar"/>
</classpath>
</taskdef>
<target name="setup">
<delete dir="${build.dir}" />
<copy todir="${build.dir}">
<fileset dir="${websrc.dir}" />
</copy>
</target>
<target name="cssDataUriEmbed" depends="setup" >
<!--Standard embed-->
<cssurlembed
root="${build.dir}"
fromdir="${websrc.dir}/css" destdir="${build.dir}/css" suffix="-datauri">
<include name="site.css"/>
</cssurlembed>
<!--MHTML embed-->
<cssurlembed
root="${build.dir}"
mhtml="true" mhtmlRoot="http://www.mydomain.com"
fromdir="${websrc.dir}/css" destdir="${build.dir}/css" suffix="-mhtml">
<include name="site.css"/>
</cssurlembed>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment