public function JsOptimizer::clean in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Asset/JsOptimizer.php \Drupal\Core\Asset\JsOptimizer::clean()
- 9 core/lib/Drupal/Core/Asset/JsOptimizer.php \Drupal\Core\Asset\JsOptimizer::clean()
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.
File
- core/
lib/ Drupal/ Core/ Asset/ JsOptimizer.php, line 47
Class
- JsOptimizer
- Optimizes a JavaScript asset.
Namespace
Drupal\Core\AssetCode
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;
}