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

1 Like

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"

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…

2 Likes

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