GET A QUOTE

How To Enable debug mode for Drupal 8

Drupal development company
Drupal 8 provides the best in-class caching mechanism to the Drupal powered websites. It has simple and easy to use for front end user. But, it can be a cumbersome process for developers during the project development. We can disable debug/caching mode during drupal theme integration to ease during theme integration/front end development work.

 

Steps to disable caching mechanism:

1. Disable render caching and CSS/JavaScript aggregations

The below code available in settings.php. It is mandatory to remove the comment for managing the task. Please edit sites/default/settings.php file to uncomment the below code.

if (file_exists(__DIR__ . '/settings.local.php')) {
include __DIR__ . '/settings.local.php';
}

It’s critical important that the code is at the bottom of your settings.php file ,so that the local settings can override the default settings.

After that, please copy the sites/example.settings.local.php to sites/default/settings.local.php and clear the cache. Then, edit the settings.local.php file and set below configuration to False. Below configuration will help you to disable css and js aggregation for the website.

$config['system.performance']['css']['preprocess'] = FALSE;
$config['system.performance']['js']['preprocess'] = FALSE;

Please copy /sites/development.services.yml to sites/default/services.yml.

2. Enable Twig debugging options for theme integration

Please open services.yml file. It will have twig.config[debug] mode settings or you can add sites/development.services.yml file if you follow the steps above to use settings.local.php file. Please make changes as per below configurations.

# Enable Twig debugging.
parameters:
twig.config:
debug: true
auto_reload: true
cache: false

After these changes, it will be easier to find out which portion of HTML code has been written in which templates file, in the source code. You will see each part of Twig templates surrounded by HTML comments that contain the matching suggestion templates.

We hope that the information shared here is helpful for your Drupal configuration. Drop us an e-mail at info@cmsminds.com to share your thoughts, questions and the topic of interest that you would like to hear from us, in future.We are certified Drupal development company with team of Drupal experts. We offer flexible support on projects on as needed basis or a full-blown project from vision to deployment.

Quick Inquiry