wdavidw/node-connect-coffee-script — pull request #3 by davewasmer (2012-08-29 21:06:15+00:00)
Title: Patched path handling to allow for separate build directories

The original path handling prevented having a separate build directory from the source directory (i.e. `/src/app.coffee` compiling to `/build/app.js` when the latter is requested).

I patched the path handling and added a `baseDir` option. Assuming you want your files to look like this:

my-app/
|-- index.coffee # your express server
|-- public/
|-- src/
|-- app.coffee
|-- build/
|-- app.js

you'll need to pass in these options (in CoffeeScript):

app.use require('connect-coffee-script')
src: 'src'
dest: 'build'
baseDir: path.join(__dirname, 'public')

With this setup, a request from the browser for `/build/app.js` will check `my-app/public/src/app.coffee` as the source file, and recompile if necessary, saving the result to `my-app/public/build/app.js`