loading...

Discussion on: How to use Laravel Blade @stack('scripts')

Collapse
slowwie profile image
Michael

The problem with @stack and push is, you can replicate it.
When push would not end up repeating the same script, this would be a crazy powerfull tool.

Collapse
leettaylor profile image
Lee Taylor

There's now a @once component in Laravel 7.2.x that would be useful for achieving that. So you could do something like this...

@push('scripts')
    @once
        <script src="{{ global_asset(mix('/js/example.js')) }}"></script>
    @endonce
@endpush
Enter fullscreen mode Exit fullscreen mode
Collapse
abrardev99 profile image