7
votes

I'm developing a new theme for Drupal 8. I need to disable all caching mechanisms in Drupal. I found the configuration for twig caching and CSS/JavaScript but not for other things of Drupal (like .theme files, etc.).

I found some hints here:

In the first linkt you find some entries beginning with cache. and in the second link how to deactivate probably the backend cache?

Although if I paste those two lines:

$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';
$settings['cache']['bins']['render'] = 'cache.backend.null';

into my settings.php Drupal shows a message that there has been an error with the page.

1

1 Answers

13
votes

to disable entire cache (twig + Drupal cache) :

first copy and rename the sites/example.settings.local.php to be sites/default/settings.local.php

$ cp sites/example.settings.local.php sites/default/settings.local.php

then open settings.php file in sites/default and uncomment these lines:

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

now open settings.local.php and change the to be TRUE

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

and uncomment all these to Disable the render cache and Disable Dynamic Page Cache

# $settings['cache']['bins']['render'] = 'cache.backend.null';
# $settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';

for twig cache open development.services.yml and add

parameters:
  twig.config:
    debug : true
    auto_reload: true
    cache: false

for more info https://www.drupal.org/node/2598914