renatomarinho / laravel-page-speed

Package to optimize your site automatically which results in a 35%+ optimization
MIT License
2.4k stars 275 forks source link

LARAVEL 9 Code Debug Screen Not Showing After Enable Page speed #168

Open manish0197 opened 2 years ago

manish0197 commented 2 years ago

I AM Using This PHP And Larvel Version

"php": "^7.3|^8.0",

    "laravel/framework": "^9.19",

    "renatomarinho/laravel-page-speed": "^2.1"

I Already Enable APP_DEBUG=true

Laravel's code debugger screen blank show whenever there is a bug in the code

fh32000 commented 1 year ago

@manish0197 @renatomarinho @swilla @f-liva @vinkla see https://github.com/spatie/laravel-ignition/issues/107

emkcloud commented 7 months ago

Code Debug Screen use this code javascript that is removed for comment. It's a bad technique to execute JavaScript and comment it out if the browser doesn't have JavaScript enabled. It's a technique that I would actually avoid.

More problems than solutions. One of the problems is precisely the minification regular expressions that, 99% of the time, remove the code, thinking it's a comment.

<script>
    <!--
    function e(){return(e=Object.assign|| ..........
    return c.createElement( ............
     return c.createElement( ............
     return c.createElement( ............
     -->
</script>

I use this code before minify code con other packages

$content = applyMinifyJsDummy($content);
$content = applyMinifyJsValue($content);

function applyMinifyJsDummy($value)
 {
       return preg_replace('/<script>\s*<!--(.*?)-->\s*<\/script>/s','<script>$1</script>',$value);
 }
function applyMinifyJsValue($value)
 {
      return JSMin::minify($value);
 }

Not Problem with Ignition

image