railsware/js-routes — pull request #121 by olance (2014-09-01 15:39:08+00:00)
Title: Custom root option

Thanks for this awesome gem!

I needed to have my routes defined in a CommonJS-like module, bundled by browserify-rails. I added the `:custom_route` option so that I could customize further the object on which to define the routes, and improved the JS code a bit so that empty namespaces could be used.

This allows me to configure JsRoutes like this:

```ruby
JsRoutes.setup do |config|
config.custom_root = 'module.exports'
config.namespace = ''
end
```

Thus, browserify-rails picks up the file (because it contains "module.exports") and I can use `var Routes = require('./routes')` in my main javascript file.

By default, those changes have no effect on JsRoutes. All tests still pass.