The webp images are generated via a file.create:after/file.replace:after hook. In the same way, you can use a file.delete:after hook to get rid of the webp images again.
i tried something like this but it doesnt work.
Says sth like: expects object but gets string. I mean thats obvious, but i dont know how to change that.
'hooks' => [
'file.delete:before' => function ($file) {
$file . '.webp' ->delete();
$toDelete = $file->name() . '.webp';
$toDelete->toFile()->delete();
// do something before a page gets deleted
}
]