1

I disabled cache with the command

drupal site:mode dev

I have overridden html.html.twig and node.html.twig.

If I change something on html.html.twig and refresh the page, the changes take place.

If I change something on node.html.twig and refresh the page, the changes do not appear, unless I also clear the cache or edit the node.

If I open the same page with a different browser, changes do take place, but if I make another edit and refresh, it won't work.

So I thought of some kind of browser caching, but clearing the caches in Chrome doesn't help.

How can I force Drupal to re-read node.html.twig without clearing the caches or editing a node everytime?

Thanks!

2
  • seems like the cache is still populated. Is dynamic_page_cache module enabled on your Drupal site? Seems like it is and the cache bin wasn't nulled out with drupal site:mode command. Please have a look at sites/example.settings.local.php file and check if your sites/default/settings.(local.)php was modified accordingly.
    – zaporylie
    Feb 9 '19 at 10:43
  • 2
    thanks, un-commenting all the bins-related lines from example.settings.local.php and copying them over to default/settings.local.php solved the issue. If you can post your answer as an actual answer I will mark it as accepted.
    – Sifro
    Feb 9 '19 at 15:37
3

drupal site:mode dev won't turn off all the caches. Tunning caching for dev purpose requires manual changes to the settings.(local.)php.

Open the example.settings.local.php file located in the sites directory and copy its content over to site's settings.(local.)php file.
Focus on the cache bins - in your case render and dynamic_page_cache.

$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';
$settings['cache']['bins']['render'] = 'cache.backend.null';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';
1
  • 2
    And don't forget to uncomment this line if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) { include $app_root . '/' . $site_path . '/settings.local.php'; } in your settings.php
    – berramou
    Feb 9 '19 at 21:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.