What's the purpose of Twig "include with only"? What's the purpose of Twig "include with only"? symfony symfony

What's the purpose of Twig "include with only"?


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.