Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Wim Leers on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.0.x
Issue links:
Description:
drupal_clear_css_cache()
and drupal_clear_js_cache()
were tightly coupled to the default implementations of the CSS and JS asset collection optimizer services. This made it de facto impossible to swap it out. This was an oversight in #352951: Make JS & CSS Preprocessing Pluggable (also see the change notice for that issue: https://www.drupal.org/node/2034675).
drupal_clear_css_cache()
and drupal_clear_js_cache()
are now marked as deprecated. \Drupal\Core\Asset\AssetCollectionOptimizerInterface::deleteAll()
now allows for aggregate deleting. So:
drupal_clear_css_cache()
→\Drupal::service('asset.css.collection_optimizer')->deleteAll();
drupal_clear_js_cache()
→\Drupal::service('asset.js.collection_optimizer')->deleteAll();
Impacts:
Module developers