/laravel-mix-artisan-serve

Laravel Mix plugin to run `php artisan serve` by chaining `.serve()`

Primary LanguageJavaScriptMIT LicenseMIT

Laravel Mix Artisan Serve

Latest Version on NPM Software License Total Downloads

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 default npm 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

License

The MIT License (MIT). Please see License File for more information.