You are here

public function CssOptimizer::clean in Drupal 10

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

Processes the contents of a CSS asset for cleanup.

Parameters

string $contents: The contents of the CSS asset.

Return value

string Contents of the CSS asset.

File

core/lib/Drupal/Core/Asset/CssOptimizer.php, line 61

Class

CssOptimizer
Optimizes a CSS asset.

Namespace

Drupal\Core\Asset

Code

public function clean($contents) {

  // Remove multiple charset declarations for standards compliance (and fixing
  // Safari problems).
  $contents = preg_replace('/^@charset\\s+[\'"](\\S*?)\\b[\'"];/i', '', $contents);
  return $contents;
}