damianromanowski/minifyhtml — pull request #1 by berendiwema (2013-11-29 08:49:30+00:00)
Title: Originally, this filter called $response->getOriginalContent(). Calling ...

Originally, this filter called `$response->getOriginalContent()`. Calling `getOriginalContent`
returns an `Illuminate\View\View` instance; which already has rendered content available
in `$response->getContent()`.

By applying the `preg_replace` to `getOriginalContent()`,
we invoke the `__toString()` method of the `View` instance, which will cause the template to
be rendered twice... this means that all PHP code will be executed twice (
including any calls to, for example, `$user->relation` in your view) which makes this a costly operation.

So instead we should apply the `preg_replace` to the rendered content of `$response->getContent()`,
to avoid duplicate View rendering.