Laravel 5.7 Resources Directory Changes

Tutorials

August 6th, 2018

laravel-5.7-resources-changes.png

Taylor Otwell announced that in Laravel 5.7 the resources directory will be flattened instead of having an assets folder:

Flattened the resources/assets directory into resources for Laravel 5.7. ???? pic.twitter.com/wK2hKcUVFQ

— Taylor Otwell ????‍???? (@taylorotwell) July 31, 2018

Laravel 5.6’s resources directory looks like this:

1resources
2├── assets
3│   ├── js
4│   └── sass
5├── lang
6│   └── en
7└── views

And the upcoming resources directory will look like the following in Laravel 5.7:

1resources
2├── js
3├── lang
4├── sass
5└── views

You could even make a move now in your Laravel 5.6 assets ahead of this change. First, you need to update your Laravel Mix configuration:

1let mix = require('laravel-mix');
2
3mix.js('resources/js/app.js', 'public/js')
4 .sass('resources/sass/app.scss', 'public/css');

Then you can move the directories and clean up with the following:

1mv resources/assets/* resources
2rm -Rf resources/assets/

I like the change to flatten things, and I feel like it cleans up the editor sidebar and has less mental overhead for navigating.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.