-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Closed
Labels
Milestone
Description
I've been trying to come up with a way to call templates like functions (with arguments).
So far, the best I've been able to do is:
{{ include "some.template" (dict "NAME" "value") }}
Would it be helpful to simulate a Bash-like function call like this?
# Execute a template as if it were a function that takes arguments.
{{ func "some.template" $param $param2 }}
This could be used as a way to call templates that look like this:
{{ define "some.template" }}
# Arguments are passed in using an Args array.
{{ $arg1 := index .Args 0 }}
{{ $arg2 := index .Args 1 }}
# Do something
{{ end }}
Reactions are currently unavailable