Open grabcode opened 9 years ago
It looks cool for those who need this.
Now, just my 2 cents, I'm a guy who dislike declarative à là angular stuff inside HTML. I Better like readable, tweakable, maintainable code inside view.
:+1: really cool. this might be useful. Especially when providing UI components to other developers .
@capricube @JSteunou, thanks for your comments.
@JSteunou I must say in the defence of a declarative approach that it is supposedly more readable. Of course, bringing this alternative way would leave more flexibility to the framework's users, but at the end nothing prevents you to adopt a guideline in your project that would exclusively use one way or another.
I merely intend to address a pattern I may have used many times into my Marionette project since I try to split my templates into granular components I reuse pretty much always the same time and a behaviour wouldn't exactly bring much visibility to my code.
At the end of day, I strongly think it is matter of taste as you've suggested.
@grabcode this looks pretty sweet, actually been wanting something like this for awhile. It seems like you're locked into _.template though? I'm all about that Jade, so can't use it I suppose?
@JSteunou Regarding the whole "declarative or not" things, here's my 2 cents; when it comes to reusable components, like <address-selector>
, <markdown-editor>
, declarative just feels right for me. But stuff like ContentView
, SidebarView
, ToolbarView
make sense as plain subviews, because you're probably only using that in 1 place.
@jeffijoe I'm confident that should work with your current projects involving Jade for templating. Your Jade files eventually get converted into html by your asset pipelines.
To summarise, I think your templates go from JADE to HTML to JAVASCRIPT. I might be wrong in the unlikely case where your _.template has been enhanced to interpret raw Jade file (that would be weird!).
And I completely embrace your declarative or not guideline, though I really wanted to give the developer access to the full Marionette view options.
I believe Backbone/Marionette provides little opinion, hence the coder is given full power/responsibility. After all, even within the strongly opinionated Angular you can end up with a messy codebase if you don't follow internal (project/company scoped) guidelines.
Fyi, technically, this extension works in 2 steps:
I've recently been using polymer web components with marionette, it actually works great together.
You can pass data in via attributes, an 'id' or a full model (the JSON) or you can interact with the element directly, like using the ui hash.
@jmcgdz that's a superbe idea to melt this 2 together. I came across some blog posts explaining how to marry this 2 together.
Now there's some cons. Polymer turned 1 (v1, not year 1) just few weeks ago. And Polymer has a cost in term of weight, and learning curve. Of course the benefits in term of functionalities might outweigh the steep learning curve, but in my company it would be yet another rather thick layer to pass through prior contributing.
And ultimately the 2 solutions could live side by side (or not?). I won't recommend that though!
@grabcode my Jade is being preprocessed and all I am left with are compiled JS functions when the page loads.
@marionettejs/marionette-core Thoughts on promoting this to MarionetteLabs?
reminds me of https://github.com/samccone/marionette-behaviors#autoregion :goat:
:+1: on moving into labs
@grabcode We're interested is moving this to official community-supported/experimental status as a MarionetteLabs repo. Are you interested in transferring ownership to MarionetteLabs? You will be repo admin.
@ianmstew yes I am. Thanks. Could you send the instructions?
Sure thing, sorry for the delay. Your repo -> Settings -> Transfer ownership -> New owner: MarionetteLabs -> Team: viewtag. I have already invited you to the viewtag team. Once your repo is in, I will supply admin access to viewtag to the viewtag team. Welcome to MarionetteLabs!
Just a heads up, I just transferred a potentially related project over to MarionetteLabs as well, handlebars-idom. I can see an intersection of the two when it comes to parsing out Components in a couple ways:
Ever wanted a shortcut to instantiate your views directly via writing a sort of custom HTML tag into your template ? Well I gave it a shot and I'd love to get your thought. I can pretty easily create a PR though I believe it would deserve a bit of review (and test coverage).
Marionette.Viewtag
Please throw whatever comes in your mind. Would you think it is a convenient alternative way in some instances ? Would you be concerned by some compatibility issues ? Would you say there might be some performance concerns ? [...]