I have two meteor apps. Each one has a smart-package that implements a certain feature, lets say user management, in an app-specific way. I also have a third meteor smart package that lives in a shared package directory. This third package has user management templates that are common to both apps. I use iron-router.
I need to combine the shared templates with the app templates. Iron-Router has the yield keyword. This is useful for combining templates. The problem is that this only works for special, nominated layout templates.
How do you combine, or nest, templates that are not layout templates using meteor and iron-router?
Example
In the simplified example below you can see three packages and their corresponding templates. The app-*:user packages implement app specific user templates and the shared:user package implements a shared user template.
app-1:users
appUser.tpl.jade
p This is some App-1 specific text
app-2:users
appUser.tpl.jade
p This is some App-2 specific text
shared:users
user.tpl.jade
h1 This is a shared title
+appUser
routes.coffee
Router.route '/user', name: 'user'
The problem here is that the nested template must be called appUser in both the dependent smart packages. This not only prevents the templates name being appropriately descriptive for the app but, more worryingly, tightly couples the template name and makes for fragile code.
It is to prevent this tight coupling of templates that iron-router allows us to use the yield keyword, but since we cannot use the yield keyword in this context (can we?) then I am left wondering if this truly is the only way to implement shared templates?
yieldkeyword to dynamically include route specific detail templates. A non-layout template is a template that has not been so designated and therefore cannot use theyieldkeyword. - biofractal{{> yield}}then it can be used as the parameter tolayoutTemplate:in i-r. Any template can nest another one directly with{{> templateName }}without using i-r. So what exactly are you trying to do? Can you show code and what's not working? - Michel Floyd