You are here

public function CssOptimizer::clean in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Asset/CssOptimizer.php \Drupal\Core\Asset\CssOptimizer::clean()
  2. 10 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
Build aggregate CSS file.

File

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

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;
}