M
M
mrFlyer2016-07-03 15:39:34
Laravel
mrFlyer, 2016-07-03 15:39:34

How to pass a list of JS\CSS files to Laravel5 View?

How to correctly pass a list of js and css files from a view or controller to Laravel5 that need to be included in the main template?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Anton, 2016-07-03
@Yadalay

An example of how I implement it myself:
1. I write the following code in the template:
2. And in the blade files, I include scripts like this:

@section('js_files')
    <script src="{{ URL::asset('js/bootstrap.js') }}"></script>
@endsection

I
IceJOKER, 2016-07-03
@IceJOKER

as well as other variables, the principle is the same, only here instead of text there are links to js / css files.
send an array of links, and complete the master template section

I
Ilya, 2016-07-04
Hrebet @hrebet

I don't understand why these experiments when there are package managers, for example:
Stolz/Assets
In the controller:
Not to mention other advantages of using such managers. :-)

A
Alexander Fanamurov, 2016-07-07
@Fanamura

I do this through
in the main template
then in any subtemplates

@push('scripts')
Скрипты или ссылки на них
@endpush

any push completes the stack

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question