laravel/framework — pull request #5049 by stidges (2014-07-13 19:11:49+00:00)
Title: [Proposal] Add @prepend blade statement

This PR adds a new statement to place: `@prepend`.

**Use Case**

While working on a project that has multiple layouts, I created a 'footer' partial that is added in every of these layouts. One of the layouts, which has many sub views, requires a script to be run *before* the view-specific scripts, but *after* the always included scripts (like jQuery, etc.). I have tried using every type of Blade section to accomplish the prepending of that specific script, and found that it is not possible.

The `@prepend` statement can be used like this:

**_footer.blade.php**

```

@yield('scripts')

```

**layout.blade.php**

```
@include('_header')

@yield('content')

@section('scripts')

@prepend

@include('_footer')
```

**some-other-view.blade.php**

```
@section('content')
{{-- content --}}
@stop

@section('scripts')

@prepend
```

**ouput**
```html