When saving CSS to file, a rebuild is triggered for asset caches - to make sure CSS changes can be seen asap by all end users.
This can break includes of aggregated CSS / JS assets in certain situations. The problem is described in detail here: https://www.drupal.org/project/drupal/issues/2958168

For now; avoid calling removeAll() on the CSS collection optimizer service + attempt to clear the asset caches in a clean way.

CommentFileSizeAuthor
#3 3159336-3.patch908 bytesrobindh
#2 3159336-2.patch2.55 KBrobindh

Comments

robindh created an issue. See original summary.

robindh’s picture

StatusFileSize
new2.55 KB

Removed CSS & JS collection-optimizers from controller

robindh’s picture

StatusFileSize
new908 bytes

Trying another approach; invalidate the library_info cache tag after garbage collection. This cache tag is set within AssetResolver::getCssAssets().

This is also how the advagg module seems to solve this problem.

robindh’s picture

Status: Active » Needs review

#3 seems to work, but needs some more testing

jhandsta’s picture

Status: Needs review » Reviewed & tested by the community

Tested by tagging aggregated CSS/JS files for garbage collection by manually setting their creation time to >30 days ago.
With the patch in #3 the caches are invalidated correctly after a live CSS save, and the files are reaggregated.

  • robindh committed 8003124 on 8.x-1.x
    Issue #3159336 by robindh, Joris Handstanger: Avoid triggering garbage...
robindh’s picture

Status: Reviewed & tested by the community » Fixed

Alright, committed - thanks!

robindh’s picture

Status: Fixed » Closed (fixed)

Closing, since 8.x-1.0-rc3 was just created