statamic / cms

The core Laravel CMS Composer package
https://statamic.com
Other
4.1k stars 536 forks source link

`@push` and `{{ push... }}` don't work together. #9880

Closed edalzell closed 5 months ago

edalzell commented 7 months ago

Bug description

Trying to integrate Laravel views and antlers views with a shared layout and I have this in my antlers layout:

{{ stack:nav }}

But in the Blade views I can't do @push('nav') I have to do @anters {{ push:nav }} @endantlers

Would be great if they worked together.

How to reproduce

Make an Antlers layout:

<!DOCTYPE html>
<html>
    <body class="h-full">
      {{ stack:nav }}
      {{ $slot ?? template_content }}
    </body>
</html>

And in a Laravel route use @push('nav') and in an antlers view use {{ push:nav }}

Logs

No response

Environment

Environment
Application Name: Glazed
Laravel Version: 10.48.7
PHP Version: 8.3.6
Composer Version: 2.7.1
Environment: local
Debug Mode: ENABLED
URL: glazed.test
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: pusher
Cache: statamic
Database: mysql
Logs: stack / daily, front
Mail: log
Queue: sync
Session: file

Pulse
Enabled: ENABLED
Version: v1.0.0-beta16

Livewire
Livewire: v3.4.10

Statamic
Addons: 2
Antlers: runtime
Sites: 1
Stache Watcher: Enabled
Static Caching: Disabled
Version: 4.56.1 PRO

Statamic Addons
statamic/seo-pro: 5.4.4
stillat/antlers-components: 2.1.0

Installation

Fresh statamic/statamic site via CLI

Antlers Parser

None

Additional details

No response

ghost commented 6 months ago

I have the same issue, but in reverse:

In my blade layout.blade.php:

<head>
    ...
    @antlers
        {{ stack:scripts }}
    @endantlers
</head>

and in my antlers template home.antlers.html:

{{ push:scripts }}
    <p>test</p>
{{ /push:scripts }}

Nothing appears on screen. I've also tried using the blade @stack('scripts') directive instead of having to write pure antlers in the layout, but that doesn't seem to work either. I believe that this is related to the same issue?