You are here

protected function CssCollectionOptimizer::generateHash in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php \Drupal\Core\Asset\CssCollectionOptimizer::generateHash()
  2. 9 core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php \Drupal\Core\Asset\CssCollectionOptimizer::generateHash()

Generate a hash for a given group of CSS assets.

Parameters

array $css_group: A group of CSS assets.

Return value

string A hash to uniquely identify the given group of CSS assets.

File

core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php, line 172

Class

CssCollectionOptimizer
Optimizes CSS assets.

Namespace

Drupal\Core\Asset

Code

protected function generateHash(array $css_group) {
  $css_data = [];
  foreach ($css_group['items'] as $css_file) {
    $css_data[] = $css_file['data'];
  }
  return hash('sha256', serialize($css_data));
}