Enable Theme Debug in Drupal 9

services.yml

Navigate to \sites\default
create a the file sites/default/services.yml from sites/default/default.services.yml
set the parameters as follows:

  • parameters:
  • twig.config:
    debug: true
    auto_reload: true
    cache: false

settings.local.php 

Navigate to /sites/

Make a copy of example.settings.local.php and rename it to settings.local.php

Locate the following lines and uncomment

# $settings['cache']['bins']['render'] = 'cache.backend.null';
# $settings['cache']['bins']['page'] = 'cache.backend.null';
# $settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';

settings.php

Navigate to sites\default

Open settings.php and search for 'local.php'

You should then find the following code block

if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {

include $app_root . '/' . $site_path . '/settings.local.php';

}


Paste this block at the bottom of the file.
Clear all caches and you should be good to go!
Now save the file and open the developer tool. you will see the theme debug.


You may also enable by running following drush command:
drush state-set theme.debug 1


Source: https://www.reddit.com/r/drupal/comments/8j1qcx/how_to_enable_twig_debug_on_drupal_8/

 

Comments

Popular posts from this blog

Remove drupal 9 extensions from database

PHP redirect from http to https and www to non-www in Drupal 9