D
D
Dmitry2016-01-15 01:05:30
Laravel
Dmitry, 2016-01-15 01:05:30

How to dynamically include CSS/JS from a controller?

The essence is the controller, in the widget method , in addition to the processed data (list of news / etc), we also return an array with links to the necessary css and js for the current page . How to display them in the head tag, if there is already a block of generated links to css-styles and js-scripts that were returned by a method defined for a specific page?
At the moment I see only one option - css and js for widgets should be displayed after body in the same block as in head .

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Pochepko, 2016-01-15
@DJZT

Read about blade templating engine and @section() @yeild()
constructs@yeild('css')

@section('css') 
<link src=>
@stop

R
Rikcon, 2016-01-15
@Rikcon

https://github.com/Stolz/Assets
Will this work?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question