-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
Support template function definitions #8509
Comments
TL;DR: Awesome! Can't wait! I do see it as an opportunity to step away from the
Even without the returnBut I'm very excited about the possibility of adding the partialCached equivalent?Is there a cached solution in place so that the process is never done twice for the same set of argument values? best practices (too soon?)I already wonder what the best practice should be as in order to keep functions in their own files, we'd have to call a partial containing the
|
See https://pkg.go.dev/rsc.io/tmplfunc#hdr-Function_Definitions
I don't think it's practical to use that library directly, but the idea (and the parsing logic) is intriguing.
I'll use one the examples in his docs:
It would also be nice if we could support the
return
keyword for these so we could do:The above example probably shows that we should have a check to make sure you don't redefine an existing func.
/cc @regisphilibert
The text was updated successfully, but these errors were encountered: