apache/incubator-ripple — pull request #8 by DamonOehlman (2013-06-20 23:14:39+00:00)
Title: Added the ability to inject middleware into test server

Hey Guys,

Just found the ripple cli support, which I'm really excited about using. In my particular use case, I work a lot with [browserify](https://github.com/substack/node-browserify) as a development tool and there are some useful connect middlewares for "browserfying on the fly".

The pull request involves a modification to the emulate.js handler which looks for a `ripple-middleware.js` file in the path that it is currently emulating. If found, that file is included and given the opportunity to inject additional middleware into the app. And example file can be found at the following url:

https://github.com/DamonOehlman/bb10/blob/master/demo/ripple-middleware.js

The code itself looks something like:

```js
var browserify = require('browserify-middleware'),
stylify = require('stylify');

browserify.settings({
transform: [ stylify ]
});

module.exports = function(app, resourcePath) {
console.log('browserifying on resource path: ' + resourcePath);
app.use('/', browserify(resourcePath));
};
```

It certainly helps my development workflow, and I'm guessing my also help others. I've sent through a completed ICLA to Apache, as this is the first project I've contributed to within apache.

Cheers,
Damon.