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.

Comments

dejan0 created an issue. See original summary.

dejan0’s picture

Issue summary: View changes
dejan0’s picture

please find the patch attached

dejan0’s picture

Status: Active » Needs review
grienauer’s picture

Assigned: Unassigned » granik

  • a8e4df9 committed on 1.x
    Issue #3315744 by dejan0: Problems with Drupal CSS/JS aggregation
    
granik’s picture

Status: Needs review » Fixed

Just commited. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.