Configuring your Local Drupal 8 Development Environment


Coming from drupal 7 optimizing drupal 8-9 for local development is a struggle especially if you want to properly optimize your local environment in terms of enabling debugging and disabling cache for a while. The steps are not a lot but there are some "tricky" settings for having a constant local workflow. So after a lot of testing, settings reviewing and debugging this is what i have learned so far.

Step 1: Find,edit and enable your settings.local.php

  • Copy and Rename /sites/settings.example.local.php -> /sites/default/settings.local.php
  • Uncomment the following lines in your settings.php file:
    # if (file_exists(__DIR__ . '/settings.local.php')) {
    #   include __DIR__ . '/settings.local.php';
    # }
    In your sites/default/settings.local.php file, uncomment the following:
    # $settings['cache']['bins']['render'] = 'cache.backend.null';
  • Rebuild your local site configuration by visiting or your-website.local/rebuild or whatever else is your current local dev ip or domain name.

Step 2: Disable Twig Cache and Enable Debugging

Copy and rename to and add the follow settings-params to (this way everytime you run composer update or composer require etc you won't have to enter the following twig cache settings to

  http.response.debug_cacheability_headers: true
    debug: true
    auto_reload: true
be careful to follow the spaces here otherwise the .yml file will not run properly or give you an error. Clear Cache and then verify Twig debugging has been enabled by refreshing your Drupal 8 homepage. Review your source code and you should see something similar to :
<!-- END OUTPUT from 'core/themes/stable/templates/navigation/toolbar.html.twig' -->
<!-- THEME DEBUG -->
<!-- THEME HOOK: 'off_canvas_page_wrapper' -->
<!-- BEGIN OUTPUT from 'core/themes/stable/templates/content/off-canvas-page-wrapper.html.twig' -->
Now you know how and where to find all the twig templates you need for your custom theming.

Happy theming!

this is an arrow pointing back to the top of the page