Closed petercoppensdatylon closed 1 year ago
@petercoppensdatylon I love the creativity of this usage! I'd recommend something like the following.
First, extend the Eta class:
const functions = {
require: require
}
export class NewEta extends Eta {
functions = functions;
}
Then create a new instance using functionHeader
:
const eta = new NewEta({ functionHeader: "const functions = this.functions" })
Inside your template, you'll then be able to write functions.require("...")
.
Let me know how this works for you!
Hello,
Thanks for this tip. Really appreciate it. I first worked around it by passing in the functions through the render parameters, but I changed it using your suggestion. I like it better.
Best,
Peter
Hello,
I had a template using V2, that sort of had this
And then I could use the following in the template
That no longer seems to work. I get an exception
ReferenceError: E is not defined
Is there some other way to access the configuration in the templates?
Tx!
Peter