Problem/Motivation
We had a very strange issue where multiple pages (on multiple websites) were suddenly losing CSS/JS assets. After some research, we realized that problem is in the legalweb_cloud module. Because:
```
\Drupal::service('asset.css.collection_optimizer')->deleteAll();
\Drupal::service('asset.js.collection_optimizer')->deleteAll();
```
are deleting aggregated files after the `system.performance.stale_file_threshold` time period (30 days by default), but new aggregated assets are not generated before the next cache rebuild (actually 1st-page visit after cache rebuild).
Proposed resolution
One solution would be to forcefully (programmatically) rebuild the cache after the two method calls above. But since this happens daily (when running cron jobs), I don't think that would be a good approach.
A better solution would be to exclude the legalweb_cloud CSS/JS assets from the aggregation, as those assets can potentially change on a daily basis.
Probably the best solution would be to always check if something has really changed in the CSS/JS that comes with legal_web, and only if something has really changed - proceed with cleaning aggregated CSS/JS assets + rebuilding the cache programmatically. But that's an idea for another task, I'd say.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | legalweb_cloud-problems_with_aggregation-3315744-3.patch | 877 bytes | dejan0 |
Comments
Comment #2
dejan0 commentedComment #3
dejan0 commentedplease find the patch attached
Comment #4
dejan0 commentedComment #5
grienauerComment #7
granikJust commited. Thanks.