Skip to content

Instantly share code, notes, and snippets.

@dasbairagya
Last active March 26, 2020 15:12
Show Gist options
  • Save dasbairagya/7ebf5ba77f5e92cae264229f407e2fbf to your computer and use it in GitHub Desktop.
Save dasbairagya/7ebf5ba77f5e92cae264229f407e2fbf to your computer and use it in GitHub Desktop.
Enable Twig Debug | Disable Cache | Drupal 8
👉️Initial steps to follow..
📌️1.Copy example.settings.local.php from /sites to /sites/default and rename to settings.local.php
📌️2.Enable render cache by uncomment this $settings['cache']['bins']['render'] = 'cache.backend.null'; in settings.local.php
📌️3.Go to sites/default/settings.php' and uncomment the commented lines that mention 'settings.local.php'.
📌️4.Go to /sites/development.services.yml file and paste below code at the top.
👉️development.services.yml
parameters:
http.response.debug_cacheability_headers: true
twig.config:
debug: true
auto-reload: true
cache: false
services:
cache.backend.null:
class: Drupal\Core\Cache\NullBackendFactory
📌️5.(Not compulsory)After doing above just rebuild the site to avoid errors by running rebuild.php in url like: http://localhost/2020/web/rebuild.php
@dasbairagya
Copy link
Author

Make sure that settings.local.php has the below line exits in it (check the line no 40 around ).
$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';

Note: settings.local.php file is for local development. You should remove the file into production.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment