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
Comment #2
cilefen commentedCan you please look at the browser console log for errors and post them here?
Comment #3
larowlanDo you use nginx? There were notes in the release notes about this if so.
Also adding a related issue
Comment #4
gbotis commentedI 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.
Comment #5
juc1 commentedThanks 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.
Comment #6
cilefen commentedComment #7
cilefen commented@gbotis Are you using nginx?
Comment #8
juc1 commented@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.
Comment #9
cilefen commentedCan anyone using nginx verify that the release notes information about adjusting the nginx configuration are accurate?
Comment #10
agarzola commentedOur 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.ymlfile in each site’s theme to either add or change the value ofversionfor 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.Comment #11
cilefen commentedAlright this seems a duplicate issue.
Comment #12
gbotis commented@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