Laravel Mix Artisan Serve
This extension allows you to automatically serve your Laravel app with php artisan serve
with Laravel Mix.
Please make sure that you are using laravel-mix
version 4.0 or higher.
This package only runs when the
--watch
flag is passed such as with the defaultnpm run watch
command from a default Laravel install.
Usage
You can install the package with npm or yarn:
npm install laravel-mix-artisan-serve --save-dev
yarn add laravel-mix-artisan-serve --dev
Then require the extension in your Mix configuration:
const mix = require('laravel-mix');
require('laravel-mix-artisan-serve');
...
Enable the extension by calling .serve()
at the end of your Mix chain:
mix.sass('resources/sass/app.scss', 'public/css').serve();
This will serve your Laravel application at http://localhost:8000 by default.
If you need to customize the host or port, you may pass an object to .serve()
:
mix.sass('resources/sass/app.scss', 'public/css').serve({
host: '127.0.0.1',
port: '3000',
});
And you're done!
Contributing
Please see CONTRIBUTING for details.
Credits
- Adam Wathan (Adam is the inspiration behind this package (https://twitter.com/adamwathan/status/1205840365120561153))
License
The MIT License (MIT). Please see License File for more information.