Answer the question
In order to leave comments, you need to log in
Organization of laravel and js code, what are the best practices?
Is it possible to organize one view and js according to it (for example /news index.blade.php ... /widgets news.js news.blabla.js etc.) to load only certain js on certain pages. Or should everything be stored in index ?
Answer the question
In order to leave comments, you need to log in
If JS is used in only one site module, then it is normal that it is included in the views only in it, and not in the index.
Alternatively, you can use the @stack('scripts') blade directive to collect both <script src="">
in the footer area for connecting scripts, and inline js pieces to collect in a common party line somewhere at the end of the page (will not be cached by the browser (!) ).
Or use webpack / elixir bundles to connect different bundles, consisting of a different set of components in different application modules.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question