I have seen this so far on two of my unrelated 10.1 sites.

My theme's CSS loads correctly.

Then I add some new CSS and clear cache multiple times

The new CSS does not load.

At /admin/config/development/performance I uncheck "Aggregate CSS files"

Now the new CSS loads correctly.

I check "Aggregate CSS files" .

Now the new CSS does not load.

I deleted the directory /sites/default/files/css

A new css directory is created after page views but it is the same issue.

The "last modified" times on the css files in /sites/default/files/css are correct ie the CSS files in /sites/default/files/css are updating but when I search the css files for my new CSS it is not there.

Any ideas please?

Comments

Juc1 created an issue. See original summary.

cilefen’s picture

Component: cache system » asset library system
Priority: Normal » Major

Can you please look at the browser console log for errors and post them here?

larowlan’s picture

Do you use nginx? There were notes in the release notes about this if so.

Also adding a related issue

gbotis’s picture

I have the exact same issue on a D10.1 installation. When aggregate css is checked, no new aggregated css files are created if existing (sites/default/files/css) are not deleted.

For example updating header css ends up in having pages previously browsed with the old style and pages browsed for the first time using the updated style.

update:
Going back to using Drupal\Core\Asset\CssCollectionOptimizer for asset.css.collection_optimizer service instead of the new Drupal\Core\Asset\CssCollectionOptimizerLazy resolves the issue.

juc1’s picture

Issue tags: +Comment#3

Thanks for replies. Yes I am using nginx so it looks like the related issue mentioned by larowlan

My hack for now is that if I add new css to an existing file eg nav.css then the new css is ignored but if I rename the file such as newnav.css (and add this new file to mytheme.libraries.yml ) then the new css loads correctly.

cilefen’s picture

Issue tags: -Comment#3 +nginx
cilefen’s picture

Status: Active » Postponed (maintainer needs more info)

@gbotis Are you using nginx?

juc1’s picture

@cilefen I meant to say there are no errors in the console

And I have now seen the same issue on a third 10.1 site.

cilefen’s picture

Can anyone using nginx verify that the release notes information about adjusting the nginx configuration are accurate?

agarzola’s picture

Our team ran into this issue earlier this week. Drupal was serving stale aggregated assets on a large multisite project serving ~20 sites, each with its own theme. After finding #3370828: Add a setting to force CSS/JS aggregate filenames to change on cache clear, we decided to update the THEME.libraries.yml file in each site’s theme to either add or change the value of version for the libraries that have been updated since we updated the project to Drupal 10.1. This caused Drupal to serve updated aggregated assets and all sites now receive the expected styles in production.

cilefen’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

Alright this seems a duplicate issue.

gbotis’s picture

@cilefen No I am not using nginx. It's clear the issue is the one described in https://www.drupal.org/project/drupal/issues/3370828