Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update JavascriptRenderer.php #1555

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marcuschristiansen
Copy link

Update the preg_replace() functions for $cssRoute and $jsRoute to remove the site domain when fetching those assets.

I had issues with the following tags.

<link rel="stylesheet" type="text/css" property="stylesheet" href="//my-domain.com/_debugbar/assets/stylesheets?v=1709304073&amp;theme=dark" data-turbolinks-eval="false" data-turbo-eval="false">

<script src="//my-domain.com/_debugbar/assets/javascript?v=1709304073" data-turbolinks-eval="false" data-turbo-eval="false"></script>

which resulted in 404 errors. Changing the preg_replace regex pattern fixed this for me.

<link rel="stylesheet" type="text/css" property="stylesheet" href="/_debugbar/assets/stylesheets?v=1709304073&amp;theme=dark" data-turbolinks-eval="false" data-turbo-eval="false">

<script src="/_debugbar/assets/javascript?v=1709304073" data-turbolinks-eval="false" data-turbo-eval="false"></script>

Would highly appreciate some input whether this is a feasible fix or if it would break other functionality.

Update the preg_replace functions for $cssRoute and $jsRoute to remove the site domain when fetching those assets.
@josevv28
Copy link

This could fix #1575

@lepusD
Copy link

lepusD commented Mar 24, 2024

I'm on Laravel 10 and I've spent hours trying to get the debugbar to work on localhost with WampServer without running 'artisan serve' and finally found this series of threads so I thank you all as it pointed me in the right direction. I have a custom URL for my localhost set up and for me concatinating the 'APP_URL' environment variable into the file path in 'JavascriptRenderer.php' as follows has worked so far.

$html = "<link rel='stylesheet' type='text/css' property='stylesheet' href='" . env('APP_URL') . "{$cssRoute}' data-turbolinks-eval='false' data-turbo-eval='false'>";

$html .= "<script{$nonce} src='" . env('APP_URL') . "{$jsRoute}' data-turbolinks-eval='false' data-turbo-eval='false'></script>";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants