rendrjs / rendr

Render your Backbone.js apps on the client and the server, using Node.js.
MIT License
4.09k stars 312 forks source link

Possibility of Working with Marionette #434

Open samccone opened 9 years ago

samccone commented 9 years ago

Hi @saponifi3d and @spikebrehm

There is a fair amount of interest on our side of the pond in using rendr with Marionette Applications. https://github.com/marionettejs/backbone.marionette/issues/2002

I was wondering if you had any thoughts on this, would love to work with you guys on this. :+1:

saponifi3d commented 9 years ago

@samccone - Hmm that's a good question. I think Marionette might not be possible because it overrides so much on of Backbone, and Rendr does too.

Things like a Marionette Item View extends backbone and overrides the render function. This becomes problematic because Rendr also overrides the Backbone.View class to add it's own render function that knows how to render differently on the client / server.

I'm trying to think if there is a way you could shim marionette as backbone in browserify, then have Rendr extend that.. but.. I think you'll run into way more problems than it'd be worth by going down that road...

TL;DR - I don't think you can without writing an adapter for Marionette to extend Rendr, which will probably turn into writing a lot of scaffolding and just calling into Marionette functions.

spikebrehm commented 9 years ago

I agree -- there would likely be too many collisions between the two Libraries and the way they both subclass Backbone.View, Backbone.Model, etc.

That said, it looks like Marionette has all sorts of useful things, so you may be able to pull some of them in to a Rendr app, or at least build a Marionette-inspired approach.

StevenLangbroek commented 9 years ago

+1 on this. some things I think would be especially useful from Marionette:

Application and Controllers already appear to be covered quite well, as does a Router.

rjcorwin commented 9 years ago

My dream: Yo package called generator-rendr-marionette

This desire comes from: 1) I'm tired of writing boilerplate. 2) Isomorphic is a requirement.

saponifi3d commented 9 years ago

Hmmm, honestly wouldn't be too hard to make a base CollectionView and have it take a template name for the ItemView and build it that way, including an appended and all that jazz to easily hook into it. It would be more of a reimplementation of ideas from marionette than using theirs directly, which is a little sad.

As for a Yo generator.. those are pretty straight-forward to write, the difficulty becomes the difference w/ how people generally write code. Things like requireAMD vs require boilerplate are very different. Some people also prefer different styles with module.exports and I think it might be a little bit too opinionated. I could make one for both requireAMD and require, but they'll all be tied to my opinions of how i think it should be written :p if you're cool with that i can try taking it on.