Closed tanthammar closed 4 years ago
I apologize if it is incorrect to post an issue about a version that is not released yet!
@push()
@once(),
@stack('styles')
head
layouts/base.blade.php
component/default/pages.blade.php
@push('styles')
@once('styles')
Route::get('blank-component', \App\Http\Livewire\BlankComponent::class)->name("blank");
Context
|--base.blade.php @yield('body'), <head>@stack('styles')</head> |--app.blade.php @extends('layouts.base'), @section('body'), @yield('content'), {{ $slot ?? null }} |--livewire/blank-component.blade.php |--<x-pages.default /> livewire code </x-pages.default>
<head> <!-- Styles --> <link rel="stylesheet" href="{{ url(mix('css/app.css')) }}"> @livewireStyles @stack('styles') </head>
livewire/blank-component.blade.php
<x-pages.default title="Testing livewire 2"> <div class="px-6 sm:px-0"> {{ $hello }} </div> </x-pages.default>
components/pages/default.blade.php
@once('styles') <style> <!--some classes !--> </style> @endonce <div class="parent grid"> <header><h1>{{ $title ?? 'No Title' }}</h1></header> <main> {{ $slot }} </main> <footer>Footer</footer> </div>
The styles are not placed in the head they are injected into the livewire parent div
Thanks Tina,
Good call. I just pushed the fixes for these to master. Re-open if problem persists.
reopening: #1455
Same problem in new liveiwire 3
I apologize if it is incorrect to post an issue about a version that is not released yet!
Description
@push()
does not work if a livewire component is wrapped with a blade component, nothing is pushed to the layout@once(),
does push to the layout, but in the wrong place, inside the root livewire div.Steps to reproduce
@stack('styles')
to thehead
oflayouts/base.blade.php
component/default/pages.blade.php
with a@push('styles')
or@once('styles')
directiveRoute::get('blank-component', \App\Http\Livewire\BlankComponent::class)->name("blank");
Context
layouts/base.blade.php
livewire/blank-component.blade.php
components/pages/default.blade.php
The styles are not placed in the
head
they are injected into the livewire parent div