PDA

View Full Version : YUICompressor Alternatives?



mbritton
8 Mar 2012, 11:03 AM
I'm using YUICompressor and ANT to recursively minify my JavaScript:



<?xml version="1.0" encoding="UTF-8"?>
<project name="ExtJSBoilerplate" basedir=".">
<property description="YUICompressor" name="YUICompressor" value="C:/javascript/yui-yuicompressor-hudson-yuicompressor-43-40-g6e2bc23/yui-yuicompressor-6e2bc23/build/yuicompressor-2.4.8pre.jar" />
<macrodef name="yuicompress">
<attribute name="src"/>
<attribute name="target"/>
<sequential>
<echo message="Compressing files at @{src}" />
<!-- create target folder if it doesn't exist already -->
<mkdir dir="@{target}"/>
<!-- Create directories recursively first.
Exclude javascript files as they will be put by YUICompressor later on -->
<copy todir="@{target}">
<fileset dir="@{src}">
<exclude name="**/*.js"/>
</fileset>
</copy>
<!-- Compress js files recursively -->
<apply executable="java" parallel="false" verbose="true" dest="@{target}">
<fileset dir="@{src}">
<include name="**/*.js"/>
</fileset>
<arg line="-jar" />
<arg path="${YUICompressor}" />
<arg value="--charset" />
<arg value="ANSI" />
<arg value="-o" />
<targetfile />
<mapper type="glob" from="*.js" to="*.js" />
</apply>
<echo message="Files compressed and copied to @{target}" />
</sequential>
</macrodef>
<target name="compress" >
<yuicompress src="C:/Users/mike/Documents/Aptana Studio 3 Workspace/extjs_puremvc_boilerplate/js/boilerplate" target="C:/Users/mike/Documents/Aptana Studio 3 Workspace/extjs_puremvc_boilerplate/build"/>
</target>
<target name="compileCSS">

</target>
</project>


Is there a way to do this using the SDK Tools? I'd like to utilize them instead of YUICompressor, if possible, for Sencha projects.

Are there any examples of command line execution of SDK Tools that minify? Are there any examples of ANT being used to do this?

Thanks in advance!

ssamuel68
8 Mar 2012, 11:20 AM
Im looking the same, plz if u got how to do it, post it here.

I was trying to do it with Sencha SDK Tools but still nothing =(