Can Blaze parent templates or layouts share their helpers?

Hi,

I mean, is it possible to call from an inner template a helper in the parent template or layout template?
If so, how?

Thanks

You can’t directly share helpers between templates, but you can pretty easily create helpers as regular functions that can be assigned as helper functions to multiple templates.

export someFunc = function() {
  //function code
}
import someFunc from '../path/to/someFunc.js';

Template.someTemplate.helpers({
  someHelper: someFunc,
});
3 Likes

Have a look at this nice package:

3 Likes