Question: In my head section of my `form.layout.blade.php` I have the following:

```
<head>
   <script src="/js/main.js"></script>
<head>

```

This is layout file is loaded before all pages are loaded. Is there a way to *not* load `main.js` for a specific route?

Answer: 
you can use if statement like this. main.js will not load on this page

```
@if(!Request::is('subpage/url'))
    <script src="/js/main.js"></script>
@endif

```
The workaround I used for not loading scripts on all sites, is that I put script paths in variables in controllers, something like this: 

```
public function show($id){
   $scripts[] = '/js/main.js';
   view()->share('scripts', $scripts); 
   return view('view', $someData);
}

```

This allows me to use this script only on a page I really need it, like this: 

```
@if(isset($scripts))
    @foreach($scripts as $key => $value)
        <script src="{{mix($value)}}"></script>
    @endforeach
@endif

```

Hope that this can lead you in right direction.