ANT tasks for Javascript
So far jGrouse tools consist of one ANT task:
- JSMinTask - task to strip away comments and unnecessary whitespace from Javascript code
JSMinTask is a wrapper around org.inconspicuous.jsmin.JSMin by John Reilly, who ported to java original JSMin developed by Douglas Crockford. Their work is covered by license-jsmin.txt for details.
In order to use those tasks, include the following statements into your ANT build file:
<taskdef name="jsmin"
classname="jgrouse.jgtools.jsmin.JSMinTask"
classpath="${jgtools.jar}">
where property ${jgtools.jar} points to the location of jgtools.jar
The task jsmin accepts the following parameters:
output- directory containing produced compressed files-
Nested elements:
- fileset or
- filelist
Example:
<jsmin output="${buildDir}/out-js">
<filelist dir="${buildDir}/js/">
<file name="${buildDir}/js/jgrouse.js"/>
</filelist>
<fileset dir="${buildDir}/js/" includes="**/*.js"/>
</jsmin>
This task would process the file jgrouse.js and all *.js files in subdirectories and create compressed files in out-js directory. The structure of output directory matches structure of input directories.