Sushi is a simple Ant build intended to automate the packaging of Javascript code into commonjs compliant modules.
Specifically, it peforms 3 tasks:
- Download JavaScript from a URL.
- Wrap the code to create a module definition
- Apply further patches (such as defining the module identifier).
The build has been designed to run both directly or form part of a larger build.
To use Sushi, simply import the sushi.xml
into your Ant build.xml
.
Define the package
task and add use the <sushi />
element to add new targets.
<?xml version="1.0" encoding="UTF-8"?>
<project name="myApplication" default="all" basedir=".">
<import file="/path/to/sushi.xml" />
<target name="package">
<sushi source="http://code.jquery.com/jquery-1.4.2.js" id="jquery-1.4" />
</target>
</project>
Simply run with ant
.
After the build is complete, the packaged files are available in the dist
directory.
The target directory that the packages are built to can be configured by specifying the TARGET_DIR
property.
ant -DTARGET_DIR=/some/other/path
Sushi has been tested with Ant 1.6.5 and 1.7.1. The single dependency, Ant-Contrib, is bundled with Sushi.
- Work out how to make the building from an archive process more generic
- Look at a better way to store the configuration of the build (which sources to load and so on).
- Consider making all build paths configurable (temp, templates etc)