function CssOptimizer::clean
Same name in other branches
- 9 core/lib/Drupal/Core/Asset/CssOptimizer.php \Drupal\Core\Asset\CssOptimizer::clean()
- 8.9.x core/lib/Drupal/Core/Asset/CssOptimizer.php \Drupal\Core\Asset\CssOptimizer::clean()
- 11.x 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.
Overrides AssetOptimizerInterface::clean
2 calls to CssOptimizer::clean()
- CssOptimizer::processCss in core/
lib/ Drupal/ Core/ Asset/ CssOptimizer.php - Processes the contents of a stylesheet for aggregation.
- CssOptimizer::processFile in core/
lib/ Drupal/ Core/ Asset/ CssOptimizer.php - Processes CSS file and adds base URLs to any relative resource paths.
File
-
core/
lib/ Drupal/ Core/ Asset/ CssOptimizer.php, line 61
Class
- CssOptimizer
- Optimizes a CSS asset.
Namespace
Drupal\Core\AssetCode
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.