What\'s really the purpose of include with only
in Twig:
{# only the foo variable will be accessible #}
{% include \'child.html.twig\' with {\'foo\'
When you include a template, it has access to all the variables available in the including template. If for some reason you don't want that, use the only
keyword.
I haven't been in a situation when I needed that, but there might be reasons other than performance. For example, you could use it to avoid naming collisions in some scenarios.