Close ×



Get A Free Quote

Let’s get to work! Contact us with the form below at no obligation to you. Together, we’ll set the project’s scope and demonstrate you value that the experts at cmsMinds bring to projects like yours.

Tell Us A Bit About Yourself

    Select As Many Of These As Apply

    How To Enable Debug Mode For Drupal 8

    May 2017 | by Jayesh

    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.

    drupal 8 logo

    Steps to disable caching mechanism:

    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.

    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.
    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 in USA with team of Drupal experts. We offer flexible support on projects on as needed basis or a full-blown project from vision to deployment.

    Inline Feedbacks
    View all comments