octoper / statamic-html-minify

5 stars 4 forks source link

Don't minify a JSON response #7

Closed duncanmcclean closed 3 years ago

duncanmcclean commented 3 years ago

Hey again!

Just ran into another issue with statamic-html-minify where it was attempting to minify JSON responses.

This caused Livewire to return an invalid response (due to syntax issues). I imagine this would also cause issues if someone installed Statamic & this addon onto a project with an API, the same sort of problem would occur.

I've added $response instanceof JsonResponse to the conditional of ignored responses. I wonder if this should maybe be the opposite? So it only runs if the response is an instance of an HtmlResponse (not sure if that actually exists)?

octoper commented 3 years ago

Oh thank you again!! @duncanmcclean