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.
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