Answer the question
In order to leave comments, you need to log in
Connecting laravel scripts?
In the general app.blade php template, I have a construct -
Then I extend this template in the news.blade.php template and, as usual, I declare the script section -@yield('scripts')
@section('scripts')
//скрипты, относящиеся к news.blade.php
@endsection
@section('scripts')
//скрипты, относящиеся к sidebar.blade.php
@endsection
Answer the question
In order to leave comments, you need to log in
Stacks
Blade allows you to push to named stacks which can be rendered somewhere else in another view or layout. This can be particularly useful for specifying any JavaScript libraries required by your child views:@push('scripts') <script src="/example.js"></script> @endpush
You may push to a stack as many times as needed. To render the complete stack contents, pass the name of the stack to the@stack
directive:<head> <!-- Head Contents --> @stack('scripts') </head>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question