Processes the contents of a javascript asset for cleanup.

Paramètres

string $contents: The contents of the javascript asset.

Return value

string Contents of the javascript asset.

Fichier

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

Classe

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