Alex Rivera | Logout

Concatenate JS files using ANT (keeping a specific order)

Asked 2012-01-29T09:29:56.020
8

I have a bunch of js files that I need to concatenate in some specific order (becuase they are a part of an MVC implementation). How do I do this using ANT?

Edit
Report

1 Answer

16
<filelist id="filelist" dir="path/to/base/directory">
   <file name="util.js"/>
   <file name="commons.js" />
</filelist>

<target name="concat-all">
    <concat destfile="whatever" encoding="UTF-8" outputencoding="UTF-8" fixlastline="true">
        <filelist refid="filelist" />
    </concat>
</target>

We use this approach, and later resulting file is compressed via yui-compressor.

answered 2012-01-29T13:01:05.117

Your Answer