With standard instructions I have set up my configuration files "settings.php", "development.services.yml" and created "settings.local.php". The "development.services.yml" file was filled with these standard parameters:

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

And the twig files are being updated automatically without clearing cache unlike to CSS files that are not. So the changes apply after cache cleared but it is very inconvenient to do it every time as you know. What should I do?

Comments

John_B’s picture

If you have CSS aggregation disabled at Configuration > Performance there should be no need to clear caches for CSS changes to take effect, unless your browser is caching the CSS. You can disable browser caching of CSS using various developer tools. I use this one.

You often do need to clear caches when you make a change to PHP, and you may need to clear caches to see the altered CSS files if you have Varnish or othe reverse proxy caching on your server. Since clearing cache involves typing 'drush cr' in command line it takes two seconds, so cannot be so very inconvenient?

One thing people sometimes do if they find typing a long command inconvenient is to set a shell alias (tutorial). For example you could set up your shell so that when you type the command
c
it automatically runs the command 'drush cr' and clears the caches.

Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors

BWestOz’s picture

I assume that you have (as I did) followed the instructions here (https://www.drupal.org/node/2598914) and (as I did) wondered why some changes still require manual cache clearing.

I have found that changes in my custom theme css or page.html.twig do change but if I change the base theme in my theme.info.yml it would only be realised with manual cache clear.

I manually truncated every cache_* table in the database but it still didn't clear it until a manual cache clear with drush cr.

In the end I just have a shell window open with drush cr as the last command so I can push the up arrow + enter but I guess it depends on your environment.