Created
July 8, 2011 15:59
-
-
Save davejlong/1072138 to your computer and use it in GitHub Desktop.
Ant task to use the YUI Compressor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<project name="YUI Compressor" default="minify" basedir="."> | |
<property name="yuicompressor.lib" value=".ant/yuicompressor-2.4.6.jar" /> | |
<target name="minify" description="Uses the YUI Compressor engine to combine and minify CSS and JS"> | |
<!-- Remove the existing combined CSS or JS file that exist --> | |
<delete><fileset dir="css" includes="combined.*" /></delete> | |
<delete><fileset dir="js" includes="combined.*" /></delete> | |
<antcall target="minifycss" /> | |
</target> | |
<target name="minifycss"> | |
<!-- Combine all CSS files except for ones specified for IE or the content editor --> | |
<concat destfile="css/combined.css"> | |
<fileset dir="css" includes="*.css" excludes="ie.css editor.css" /> | |
</concat> | |
<!-- Minify the css --> | |
<java fork="true" jar="${yuicompressor.lib}" dir="css" output="css/combined.min.css"> | |
<arg value="combined.css" /> | |
</java> | |
</target> | |
<target name="minifyjs"> | |
<!-- Combine all JS files --> | |
<concat destfile="js/combined.js"> | |
<fileset dir="js" includes="*.js" /> | |
</concat> | |
<!-- Minify the JS --> | |
<java fork="true" jar="${yuicompressor.lib}" dir="js" output="js/combined.min.js"> | |
<arg value="combined.js" /> | |
</java> | |
</target> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment