You are here

public function JsOptimizer::clean in Advanced CSS/JS Aggregation 8.2

Processes the contents of a javascript asset for cleanup.

Parameters

string $contents: The contents of the javascript asset.

Return value

string Contents of the javascript asset.

Overrides AssetOptimizerInterface::clean

File

advagg_js_minify/src/Asset/JsOptimizer.php, line 250

Class

JsOptimizer
Optimizes a JavaScript asset.

Namespace

Drupal\advagg_js_minify\Asset

Code

public function clean($contents) {

  // Remove JS source and source mapping urls or these may cause 404 errors.
  $contents = preg_replace('/\\/\\/(#|@)\\s(sourceURL|sourceMappingURL)=\\s*(\\S*?)\\s*$/m', '', $contents);
  return $contents;
}