Laravel Frontend Presets

Taylor Otwell
2 min readApr 7, 2017

--

As many of you probably know, Laravel 5.4 ships with an Example.vue component in the resources/assets/js/components directory. In addition, Laravel Mix supports compiling single-file Vue components out of the box. This gives developers a quick, convenient starting point for building modern, robust JavaScript components for their applications.

For Laravel 5.5, this scaffolding is still in place, but we’re introducing some additional options for frontend scaffolding via a new artisan preset command.

React

If you love React, you will love Laravel 5.5. Simply run the php artisan preset react command to swap out the Vue scaffolding with React scaffolding. The default Mix configuration, components, and all other related files will be updated accordingly:

Now, instead of an Example.vue component, your application will contain an Example.js React component:

Bootstrap

Some users may not want any JavaScript scaffolding at all, but don’t want to lose the basic Bootstrap CSS scaffolding. If that’s you, you can use the artisan preset bootstrap to only remove the Vue scaffolding:

Remove All Scaffolding

Some users may even want to remove all frontend scaffolding. The artisan preset none will remove all frontend scaffolding:

I hope you enjoy these new options! I’d like to shout-out Samantha Geitz and Jesse O’Brien for their advice and work on these features!

--

--