Same name in other branches
- 5.0.x advagg_mod/src/Asset/RemoveConsoleLog.php \Drupal\advagg_mod\Asset\RemoveConsoleLog::optimize()
- 8.x-3.x advagg_mod/src/Asset/RemoveConsoleLog.php \Drupal\advagg_mod\Asset\RemoveConsoleLog::optimize()
- 8.x-4.x advagg_mod/src/Asset/RemoveConsoleLog.php \Drupal\advagg_mod\Asset\RemoveConsoleLog::optimize()
Scan asset contents for console.log() calls and remove them.
Paramètres
string $contents: The asset contents.
Return value
string The updated contents.
Fichier
-
advagg_mod/
src/ Asset/ RemoveConsoleLog.php, line 19
Classe
- RemoveConsoleLog
- Remove console.log() calls from JavaScript Files.
Namespace
Drupal\advagg_mod\AssetCode
public function optimize($contents) {
$pattern = "/ console.log(.*)/";
return preg_replace_callback($pattern, [
$this,
'removeCallback',
], $contents);
}