edge-js/edge

Section with Partials

Closed this issue · 2 comments

Description

i'm tried to use Sections inside Partials
As per doc partials are a way to extract a chunk of markup to its file and then re-use it across multiple templates.

so i would like to use it with section

example code

layouts/main.edge

<body>
    @include('content')
</body>

partials/content.edge

<section>
    @!section('body')
</section>

views/dashboard/index.edge

@layout('layouts/main')
@section('body')
    <div>Section Over Here</div>
@endsection

I try like that, section is not showed.

I know i can just merge partials/content.edge into layouts, but I just want some explanation, why section can't use with partials, Is it because section must on top from the other ?

Package version

latest

Error Message & Stack Trace

No error

Relevant Information

X

@section is not worked with @if except Partials.

I want to define a debugger in layout

    {{--  debugger  --}}
    @if(app.isDebug)
    <input id="debugger-drawer" type="checkbox" class="drawer-toggle">

    <label for="debugger-drawer"
      class="fixed right-0 bottom-0 w-12 h-12 rounded-full bg-primary cursor-pointer flex items-center justify-center">
      <i class="iconfont icon-bug-fill"></i>
    </label>
    <div class="drawer-side">
      <label for="debugger-drawer" class="drawer-overlay"></label>
      <div class="w-80 md:w-[500px] p-4 bg-base-100 overflow-auto">
        <h2>Debugger with inspect</h2>
        @!section('debugger')
      </div>
    </div>
    @endif

And inspect in the child template

@section('debugger')
<span>auth.isLoggedIn</span>
{{--  {{ inspect(auth.isLoggedIn) }}  --}}
@endsection

But it didn't work, it looks like @section nesting is not allowed.

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.