List of all Twig templates used in the current request.

I am using Symfony2 with the Twig template engine.

Is there a way to list all Twig template files loaded in the current request, including those downloaded through extends , include , etc.?

This would greatly facilitate my life when redefining blocks of third-party packages, but I can not find a way to do this.

+6
source share
3 answers

I searched for such a tool for a long time, but never found it ... The debugging options of the branch are very limited, and there is no tool in the sf2 dev panel dedicated to it ...

I always add twig or html comments on top of each of my templates to get an idea of ​​where I am and why during development or on the last page.

+2
source

You can try this code , it puts the file names in HTML as follows:

 <!-- START templatename.html.twig --> ... <!-- END templatename.html.twig --> 

I know this is not a good solution, but it is better than nothing.

+1
source

no problem when you work in dev in app_dev.php

expand the bottom SF toolbar, click on status 200 or on @your_rote_name you will redirect to smt like localhost/_profiler/s0meha5h?panel=* then click on the left menu on TWIG , then the URL will be like localhost/_profiler/s0meha5h?panel=twig

and you will see all the templates, such as FolderYourBundle: Folder: twig_file_name.html.twig, which loads one at a time!

0
source

All Articles