You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently with {value} makes {value} the root context for the nested template. So the first error is because it is trying to lookup the field color from the string. The way you are doing it is currently the best way to do, but I agree it is a bit verbose.
You should actually not have not specify with at all, but it appears there is a bug with accessing loop variables in the parent template 😬. I have fixed it in d9e46ea, so the following should work in the next release.
{%forcolorincolors%}{%include"color"%}{%endfor%}
With regards to using with I can see a few potential improvements here:
Improve passing of value into the nested template
We could support map literals and allow constructing the literal inline before passing, for example
{%include"color"with { color: color } %}
This is still a bit verbose
Improve referring to the root context
We could support referring to the current root context with .
Hi, I’m a little puzzled, when including a template can I not pass a simple string inside it using the with keyword?
Main template:
Color template:
The error I get:
In order to compile I must do the following but it feels verbose.
The text was updated successfully, but these errors were encountered: