RESOLVED: @livewireScripts and @livewireStyles showing on page

What seems to be the problem:
@livewireScripts and @livewireStyles is displayed on the screen after upgrading to 0.6.0

Steps to Reproduce:
Upgrade Livewire … change @livewireAssets to @livewireScripts and @livewireStyles

Are you using the latest version of Livewire:
I am using 0.6.0 and do not want to upgrade further because I don’t want to lose the vue.js integration

Do you have any screenshots or code examples:
I have a screenshot and any code example neededUAM_Teamsite

I’ve seen this problem after upgrading or pull a branch onto a new machine.

The remedy for me has been to make a small change in each of the files that has the @ call and then save the file.

I would have thought this is what php artisan livewire:discover would be for, but did not work for me.

<update after more thoroughly reading your problem>
Ah, wait. You see the directives in your rendered page? Then I would suggest clearing your cache if the solution of @ryatkins is not working
</update after more thoroughly reading your problem>

From the change notes of version 0.6.0:

Added @livewireStyles and @livewireAssets directives to separate out the styles and the scripts. This allows users to register styles separately in the <head> , but scripts at the bottom of the <body> tag. This arrangement is the new official recommendation (for other JS-related reasons (like registering custom directives)), and the current @livewireAssets directive will likely be removed in the next major version release ( 1.0 )

This is not a problem. If you want the old behavior you can just place both directives like this:

<head>
     @livewireStyles
     @livewireScripts
</head> 

And to not further update you can set Livewire in your composer.json to a fixed version:

"livewire/livewire": "0.6.0"

or

"livewire/livewire": "0.5.3"
1 Like

Thanks. I ran composer dumpautoload and php artisan config:cache on the staging server and they are gone.

1 Like

Just got kind of same issue in a Livewire version v1.1.0 (Laravel v7.13.0, php 7.3, Plesk, ubuntu)
@livewireScripts and @livewireStyles were no working! They just rendered from blade template as plain text…
The fix was actually strange.
Changing it to @livewireScripts() and @livewireStyles() resolved this issue for me…

4 Likes

@Dimonka2 I just created an account to say thank you, saved my day :slight_smile:

@Dimonka2 You are a life saver. :grinning: I had the same issue on Laravel 8.12 with Livewire 2.3.

Sorry but still not working for me all livewire helpers are not working, I tried all suggested solutions in this thread…

Any errors in the console?

Right, sometimes blade engine for some reason not rendering registered commands. Sometimes even recompiling or adding spaces (to cause recompiling) helps to resolve it. Pretty stupid, but it is not really Livewire related, more Laravel issue.

2 Likes

and the important thing don’t forget to look into guide installation: https://jetstream.laravel.com/1.x/installation.html#install-jetstream-with-livewire
and verify that you already installed liveware.
else look @Dimonka2 responses.
thanks.

I had the same problem. I delete the spaces and brought @livewireStyles and the otherone to new line by pressing Enter. That works. You saved my life.

Thanks @Dimonka2 that fixed it for me :+1:

Thanks, saved my day!!!