I am currently using a YUI compressor during the ant build process to minimize CSS and JavaScript files. While it minimizes each file, I would like it to give the name of the file that the executable is currently trying to apply, so that if an error occurs, I know which file is causing the error. For instance:
[echo] Minifying JS files... [echo] Trying to minify file1.js... [echo] Trying to minify file2.js....
Each solution I saw seems to simply reflect the entire file name in the fileset after the application instruction has been applied to all files.
Currently, my ant build is as follows:
<target name="minifyJS" depends="overwriteCSSWithMinified"> <echo message="minifying js files and saving them to fileName-min.js" /> <apply executable="java" parallel="false" dest="${toWebHome}"> <fileset dir="${toWebHome}"> <exclude name="**/*.min.js" /> <include name="**/*.js"/> </fileset> <arg line="-jar"/> <arg path="yuicompressor-2.4.7.jar" /> <arg line="-v"/> <srcfile/> <arg line="-o"/> <mapper type="glob" from="*.js" to="*-min.js"/> <targetfile/> </apply> </target>
Maybe there is another way to do this, instead of using a set of files, use an instruction that cycles through each file one at a time and performs an action on the file?
user754691
source share