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
There are certain times where I want to return the output of a rendered template as a string, which I can then set as the value of a variable.
E.g. Rather than have {% include "path/to/partial" with {foo: 'bar'} only %} I would want to have {% set myVar = include("path/to/partial", {foo: "bar"}, false) %}
Although I've used this without problems on other websites using Twig (e.g. Craft CMS), it doesn't look like this functionality is available with this package? When I try to use include as a function, I get the following error in my terminal:
TwigException: include function does not exist and is not defined in the context
I'm assuming there is a way around this by adding Twig.exports.extendFunction('include', ...) to the grunt config for the task, but I'm having trouble working this out. Any help would be appreciated.
The text was updated successfully, but these errors were encountered:
There are certain times where I want to return the output of a rendered template as a string, which I can then set as the value of a variable.
E.g. Rather than have
{% include "path/to/partial" with {foo: 'bar'} only %}
I would want to have{% set myVar = include("path/to/partial", {foo: "bar"}, false) %}
Although I've used this without problems on other websites using Twig (e.g. Craft CMS), it doesn't look like this functionality is available with this package? When I try to use include as a function, I get the following error in my terminal:
TwigException: include function does not exist and is not defined in the context
I'm assuming there is a way around this by adding
Twig.exports.extendFunction('include', ...)
to the grunt config for the task, but I'm having trouble working this out. Any help would be appreciated.The text was updated successfully, but these errors were encountered: