In drupal 7 i was able to make changes to css during development and have them reflected without having to clear the caches for every little styling adjustment. I also used to be able to have one 'style.css' and include other files inside it like @include header.css, etc.

In drupal 8, this is no longer the case. Every individual file seems to have to be in the yml library to work at all, and every single change to a css file requires clearing the caches before it will show up. This is especially annoying since doing that takes about 10 times longer in 8 than it did in 7.

2 questions:

1. Is there anything I can do about this? I can't find a way to disable caching.

2. Why the heck would would they change from something that was so simple and worked great to something this annoying in the first place? This seems like a downgrade from 7.

Comments

wafer’s picture

Yes @Frumpus right! In Drupal 8,I am still strange that after a lot of heep of try,still unable to figure out how to disable my theme(twig) cache while developing a Drupal 8 theme.

Frumpus’s picture

I have managed to fix this by going to admin/config/development/performance and unchecking the css and js boxes in the 'bandwidth optimization' section.

Hope this will help someone.

cretney’s picture

Helped me, thanks!

nicocean’s picture

helped me too!

pchristopher’s picture

Also helped me! Cheers!

adrian1231’s picture

I am also finding that none of the examples online are working for me. First of all, they make mention of changing the sites/default/services.yml file, but I am not actually seeing this file in my folder structure. What I am instead seeing is sites/default/default.services.yml.

Made the changes in this file regardless, but the twig templates were still being cached -___-.

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

cretney’s picture

You'll need to copy default.services.yml to services.yml (in the sites/default directory) in order for Drupal to load services.yml (it's not looking for default.services.yml). Also, disabling the aggregation of css and js under /admin/config/development/performance worked for me as well.

adrian1231’s picture

Yea, I figured that out around the same day I made the comment. Should have left an update.

trangunghoa’s picture

Thanks a lot @adrian1231

mmjvb’s picture

See https://www.drupal.org/node/2598914 for more documentation.

imanoop’s picture

Hi
First you need to copy the development.services.yml from sites folder to sites/default to services.yml and changes the
twig.config:
debug: true
auto_reload: true
cache: false

It will work to disable cache at the time of development.

christine1126’s picture

Thanks, it works :)

atomicnation’s picture

I'm using gulp and Live Reload, it works fine for my twig files (I try by changing my page.twig.html), but for css I still have to clear the cache.

I have unticked "Aggregate CSS files" and I have set local development services to $settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml'; in my default/settings.local.yml

So in theory all should work.

Any other ideas?

zebda’s picture

Turn off caching in your browser (Chrome).

I had the same problem, in my case it was not the Drupal Cache but the Browser Cache. I'm working with Chrome when i disabled the caching when developer tools is open, it was fixed.