Twig Debug¶
Purpose¶
During Twig development, we need to enable Twig debugging to see what are the template suggestions and which files to override.
Outline¶
- Enable local settings
- Use development service yml file
- Override Twig parameters
Resources¶
Guide¶
- Copy
sites/example.settings.local.php
tosites/default/settings.local.php
- Edit
sites/default/settings.local.php
line 92 to changeDRUPAL_ROOT . '/sites/development.services.yml
to__DIR__ . '/../development.services.yml
- Uncomment the files that include the
settings.local.php
insettings.php
php if (file_exists(__DIR__ . '/settings.local.php')) { include __DIR__ . '/settings.local.php'; }
- Edit
sites/development.service.yml
to override Twig parameters. Add the following lines with spaces to the end of the file.yml parameters: twig.config: debug: true