0

I am using closure compiler to minify javascript via the ant task. My build file is getting cluttered. Also, I am not minifying the javascript files in dev environment. Currently I am declaring the javascript files in two places. Once inside build.xml in Closure Compiler Ant Task and the other inside FreeMarker template page for un-minified version. I want to move the declaration of javascript files into a comma separated values in a .properties file. How can I configure Closure Compiler Ant Task so that it reads from a properties file ?

    <target name="minimize-javascript" description="Create a minified version of the various JS scripts using Closure Compiler">
    <taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask">
    <classpath refid="jars.classpath"/>
    </taskdef>
    <jscomp compilationLevel="simple"
        debug="false" output="${web.dir}/resources/js/minimized.js">

        <sources dir="${web.dir}/resources/js/src/deps/jquery/1.8.3/">
            <file name="jquery-1.8.3.js"/>
        </sources>
        <sources dir="${web.dir}/resources/js/src/deps/jquery/ui/1.8.24">
            <file name="jquery-ui.js"/>
            <file name="jquery.ui.core.js"/>
            <file name="jquery.ui.widget.js"/>
            <file name="jquery.ui.tabs.js"/>
            <file name="jquery.ui.sortable.js"/>
            <file name="jquery.ui.selectable.js"/>
            <file name="jquery.ui.resizable.js"/>
            <file name="jquery.ui.position.js"/>
            <file name="jquery.ui.mouse.js"/>
            <file name="jquery.ui.droppable.js"/>
            <file name="jquery.ui.draggable.js"/>
            <file name="jquery.ui.dialog.js"/>
            <file name="jquery.ui.button.js"/>
            <file name="jquery.effects.core.js"/>
            <file name="jquery.effects.drop.js"/>
        </sources>
    </jscomp>
</target>
ShaggyInjun
  • 2,880
  • 2
  • 31
  • 52

1 Answers1

0

Don't know if you solved your problem - you can start with a fileset and it can get all the .js files rather than declaring them one by one.

<fileset dir="${web.dir}/resources/js/src/deps/jquery/ui/1.8.24">
      <include name="**/*.js"/>
</fileset>

This means you don't need a properties file.

Damien
  • 159
  • 1
  • 1
  • 11
  • Problem with this approach is there is no guarantee of the sequence / order. I have actually tried this and my page doesn't render well. – ShaggyInjun Jun 25 '13 at 14:45