Skip to main content

Devbit

How to enable Twig debug in Drupal

You work with Twig templates and need to use the debugger.
parameters:
  twig.config:
    debug: true
    auto_reload: null
    cache: false

Issue:

You work with Twig templates and need to use the debugger.

Solution:

Code solution:
Enable Twig debug by copying the snippet provided from root/web/sites/default.services.yml into root/web/sites/development.services.yml

See also: Drupal Docs on Twig

Sitebuilding solution:
Navigate to the administrative area via the admin toolbar to Configuration -> Development -> Development settings or via the path /admin/config/development/settings
 

Enabling twig debug 1


Enable the checkbox Twig development mode, as well as Twig debug mode and Disable Twig cache.
 

Enabling twig debug 3

For further information regarding Drupal and Twig take a look at  https://www.drupal.org/docs/develop/theming-drupal/twig-in-drupal/debugging-twig-templates

Info

This should only be used for local development environments but disabled in production.

Profilfoto Mathias Grab

Mathias Grab

Trainee Webentwicklung

Test

Ihre Drupal-Website zukunftssicher machen

Wir prüfen Ihr System und zeigen, was Sie für AI, Wartung und Upgrades brauchen.