GeppettoJS / backbone.geppetto

Bring your Backbone applications to life with an event-driven Command framework.
http://geppettojs.github.com/backbone.geppetto/
MIT License
203 stars 28 forks source link

Make compatible with CommonJS #47

Closed creynders closed 10 years ago

creynders commented 10 years ago

I'm moving away from RequireJS since it's so ... um ... I dunno, I just keep on struggling with it and I loathe the boilerplate. So I'm migrating to Browserify which is really awesome, especially since I do front and backend, which means I can use the same module importing syntax on both.

  1. I added the necessary code to geppetto to allow it to be loaded CommonJS style
  2. I moved "backbone" from being a dev dependency to being a real dependency and added underscore as a dependency as well. This allows the installation of geppetto through npm instead of bower
  3. I changed "main" in package.json to point to the geppeto file. This allows loading geppetto with require("backbone.geppetto") otherwise you need to provide a path (i.e. require("backbone.geppetto/backbone.geppetto"))

I have no idea how to test this through mocha, so I did some manual testing and it all worked out. I looked at Marionette and they don't seem to be testing whether the framework's exposed as CommonJS module either.

geekdave commented 10 years ago

Yeah, I hear Browserify is all the rage now. Gotta check it out myself.

creynders commented 10 years ago

@geekdave Definitely do so. I can't imagine anybody sticking to RequireJS after having tried out Browserify. Obviously I'm not using it for a very long time yet, so maybe I still need to encounter the bad parts, but it has got this it-just-works feel to it. Took me an hour or so to figure out how to fit all the pieces of the puzzle together (browserify, grunt, handlebars, backbone and shimming old-skool libs) but it was all pretty painless and transparant.

geekdave commented 10 years ago

@creynders : Will do - thanks for the insight!