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.phptosites/default/settings.local.php - Edit
sites/default/settings.local.phpline 92 to changeDRUPAL_ROOT . '/sites/development.services.ymlto__DIR__ . '/../development.services.yml - Uncomment the files that include the
settings.local.phpinsettings.phpphp if (file_exists(__DIR__ . '/settings.local.php')) { include __DIR__ . '/settings.local.php'; } - Edit
sites/development.service.ymlto override Twig parameters. Add the following lines with spaces to the end of the file.yml parameters: twig.config: debug: true