longshotlabs / meteor-template-extension

A Meteor package: Replace already defined templates, inherit helpers and events from other templates
https://atmospherejs.com/aldeed/template-extension
MIT License
220 stars 20 forks source link

Can I use this for true inheritance on templates? #57

Open ecarlotti opened 6 years ago

ecarlotti commented 6 years ago

First of all, this is really great work, guys. All the code you have shared helps a lot.

What I mean by "true inheritance" is that I need to produce a package that has the bare-bones of the user interface (the settings interface, to be exact) for a loader application written in MeteorJS. The client code has the LOG viewer and the settings while the server code does all the hard work for the loader itself, parsing data and inserting it into MongoDB.

The problem is I was trying to build the default user interface package but at some point, I would add a {{> _DUMMYloaderSettings}} that would then be overwritten by a child template (in my case on the main application itself since the parent UI is encapsulated in a package) by means of the Template.loaderSettings.replaces('_DUMMYloaderSettings').

This method works fine for the visual part, since I can simply put the specific settings in my new template and have all standard settings be handled by the default UI interface on the package. The only problem is that (as documented) the helpers and events on the child template are simply not fired.

Is there any workaround (or an alternative way) for implementing such inheritance?

Thanks in advance, /Edson Carlotti.