Friday, 10 February 2017

Compress js files for minifying them


For compressing js files we need yuicompressor-2.4.7.jar file . Add below metioned target in your build file and then call it as needed.



<target name="compressingjsfile">
<echo message="Compressing Javascript files at location: <<<<Your js folder location>>>>" />
<java jar="lib/yuicompressor-2.4.7.jar" fork="true">
<arg value="yourjsfilename11111.js" /> <!-- input path for JS files -->
<arg value="yourjsfilename111222.js" /> <!-- input path for JS files -->
<!--<arg value="-v" /> --><!-- Turn on verbose -->
<arg value="-o" />
<arg value="'.js$:.js'" />
<arg value="yourjsfilename11111_min_out.js" /> <!-- output path for JS files -->
<arg value="yourjsfilename111222_min_out.js" /> <!-- output path for JS files -->

<classpath>
   <pathelement location="lib/yuicompressor-2.4.7.jar"/>
</classpath>
</java>
</target>

0 comments:

Post a Comment

 
;