mercredi 29 août 2018

How can I include js files correspondes to render files in laravel blade template?

In my laravel app I have app.blade.php with following code

<html>
    <body>
        <div>
            @yield('content')
        </div>
        <script src="" ></script>
        <script src="" ></script>
    </body>
</html>

I have several pages such as page1, page2 etc and each page is rendering as page1.blade.php etc and these pages has separate javascript files like page1.js, page2.js.

page1.js should be included with page1.blade.php only and same for page2.js also. How can I include js files for the corresponding blade files?

My page1.blade.php is

@extends('layouts.app')

@section('content')
<section class="content-header">
  <h1>
    Page 1
  </h1>

</section>
@endsection



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2MTt2C7
via IFTTT

Aucun commentaire:

Enregistrer un commentaire