Ah, seems Template.contentBlock defines where content is “transcluded”, but it’s limited to transcluding children into a single place (unlike Angular, React, and ShadowDOM). (Or did I miss how to do that?)
Although the guide shows a brief example of Template.contentBlock, it’s not immediately clear that that is what places the children. This article in addition to the guide helped:
You are basically correct. The idea of “multiple” slots for children and treating children like arguments to a function is rare even in React/Angular. Blaze simply has no concept of that as it is always providing content to it’s own rendering system.
The three systems you mentioned pass pieces of an XML tree around until you are done “playing” with them, and then does the patching. This results in cleaner faster updates while also allowing you a lot more flexibility in mangling/managing that tree, especially with regards to things like this.
Is it possible to place different parts of the children of a block helper (i.e. first child, second, child, etc) into different places like we can do in React, Angular, and ShadowDOM?
Thanks for checking out my article. I wrote another article that discussed meteor composability and doing things like this using Template.dynamic. It’s a little verbose, but it might get you closer to where you want to be, or give you a few ideas, at least.
You may also be able to tear apart your Template.contentBlock within your block helper and pull out each individual DOM node. From there, you might be able to find a way to inject them where you see fit. I’m just thinking out loud here…
@gadicc Any other possibilities? Just wondering since I know in famous-views you were able to have nested components work well with each other (f.e. DOM elements inside your Surface block helpers).
Hey, no, I’m not aware of any way to split up a contentBlock. If you really want everything in-line, I guess you could use another helper to populate an array in the parent: