Inject Methods/Object with Plugins
Is your feature request related to a problem? Please describe. Currently there isn't a nice clean way to inject methods or objects with plugins for usage in the template.
Describe the solution you'd like Some way to inject methods for usage.
Additional context
Carrying over discussion from Gitter, we could allow modification of prototype (I don't think that works), allowing injecting into this of template, or use some scoping tricks with dynamic closures to handle this (still thinking about it).
Possible usage:
module.exports = {
injectThis: (config) => {
return {
add: (a, b) => a + b
}
}
}
<%= this.add(2, 3) %>
I'd really need this as well for e.g. global translation methods 👍🏻
@shadowtime2000 any updates or way one can help out with this?