Hacker News new | ask | show | jobs
by jaredhanson 4788 days ago
This looks really great! One thing really bothers me however: a dependency on all of Backbone. Pulling in a bunch a view-related code for an ORM has a certain code smell.

Is there any effort to modularize Backbone itself, so that Bookshelf can only depend on the model and collection pieces?

1 comments

Thanks for checking it out! While the view/history/router related code should be okay just sitting there unused, I agree that does seem like a bit of a code smell. I know Jeremy has been against modularizing Backbone in the past, and there is something to be said about keeping everything packaged nicely together in a single file - though maybe something like this would change his mind.

It's definitely something I'll begin to look into a bit, possibly splitting up the Backbone components into a separate library specifically for Bookshelf, similar to lodash's custom build process. If you have any ideas for a good way to go about this, feel free to open a ticket.

Demis Bellot took a crack at modularizing jQuery, perhaps there is inspiration there: https://github.com/mythz/jquip