The compiler middleware will run any data read in through the asyncronous compile function and
then save the results to the dest directory. If the source file has not changed, then the compiler
will immediately call next to allow the next middleware (such as static) to finish handling the
request, otherwise the compile function is called with an inputStream and outputStream. When
the outputStream ends (emits the end event) then next will be called so the next middleware
can finish the request.

This example sets up the combiner to read in files from the __dirname + '/scripts', combine any
with the extension .js and write them to the __dirname + '/static/scripts' directory. Note that
files will be combined alphabetically by file name, so a-file.js will come before z-file.js.

var app =require('express')();

var combiner =require('resource-compiler').combiner;

// Set up the combiner middleware.

app.use('/scripts', combiner({

src :__dirname+'/scripts',

dest :__dirname+'/static/scripts',

ext :'.js'

}));

// Use static to then serve the data to the client.

app.use('/scripts', express.static(__dirname+'/static/scripts'));

If you had the directory structure:

- scripts/

- app/

- app.js

- ignored.json

- someFile.js

- widgets/

- awesomeWidget.js

- coolestWidgetEver.js

- /lib

- angular.js

- jQuery.js

- lib.js

And a request of GET /scripts/app.js came in, the combiner would read in the files, in this order:

/scripts/app/app.js

/scripts/app/someFile.js

/scripts/app/widgets/awesomeWidget.js

/scripts/app/widgets/coolestWidgetEver.js

Then combine them into one stream and save that to /static/scripts/app.js. Notice that the file
/scipts/app/ignored.json will not be combined in the final script and that the directory
/scripts/app/widgets was recursed into and each .js file added as well.