I'm reading up in choosing the correct client-side framework to segment/modularize my frontend code in Widgets.
Basically what I have/want is:
- a complex website with multiple pagetypes, so no single-page application.
- all pages are able to render a complete page WITHOUT the use of javascript. IOW: javascript is used as enrichment only.
- Lots of pages have a very dynamic way in which widgets can be shown on screen. To overcome complexity at the server-side I've modularized my code into widgets (composite pattern), where each widget is responsible for it's own:
- server-side controller code
- server-side templating (using hogan/mustache)
- routing endpoints, should it need to be called from the client
- structural css (css converning the structure of the widget as opposed to the look&feel)
- a server-side RegionManager ultimately decides which widgets are rendered and where they are rendered on screen. Endresults is that the RegionManager spits out the entire html (server-generated) as the composite of the rendering of all of it's widgets.
Now, some of these widgets DO have client-side logic and need rerendering on the client. Take a searchpage for instance, which needs to be able to update through ajax. (I've described this process, which uses DRY templating on client and server, here)
What I ultimately want is that, given I already use the composite pattern on the server, to extend this to the client somehow so that a Widget (1 particular logic block on the screen) contains all mentioned server-side code, plus all needed client-side code.
I hope this makes sense.
Would Marionette be suited to be used as a client side framework in this scenario? I'm asking since I'm not 100% sure if the concept of a Marionette Module is what I describe as being a Widget in above scenario. (I'm mentioning Twitter Flight in my question, since I believe this would be a fit, but it currently is so new that I'm hesitant to go with it at the moment_
I think basically what I'm asking is if anybody has some experience doing something along these lines.
Marionette
is probably overkill for what you're looking to do, but a straight-upBackbone.View
could be helpful for DOM manipulation. Using aBackbone.View
module would help organize your code and scope your DOM manipulations to one element. – Garrison