public function RemoveConsoleLog::optimize in Advanced CSS/JS Aggregation 8.3
Same name and namespace in other branches
- 8.4 advagg_mod/src/Asset/RemoveConsoleLog.php \Drupal\advagg_mod\Asset\RemoveConsoleLog::optimize()
Scan asset contents for console.log() calls and remove them.
Parameters
string $contents: The asset contents.
Return value
string The updated contents.
File
- advagg_mod/
src/ Asset/ RemoveConsoleLog.php, line 19
Class
- 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);
}