-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling helper functions inside templates #175
Labels
Comments
One option would be to pass the function directly to your template:
|
or
|
probably can be added to documentation |
add to doT 101 #205 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have several different templates, each in their own file, in which I need to show dates, like the following:
I'd like to format that date, using
moment.js
, and also add some logic to printunknown
when the date is null. Because that happens in a lot of places I created a helper:But I can't find a way to call that function inside the template. I'm using Node, so I don't want to pollute the global namespace. I even tried putting that in an utility object and
require
-ing it at the top of my template, to no avail:FWIW, the generated template function above looks like this:
and the error is
The text was updated successfully, but these errors were encountered: