Laravel Mix extension to auto-reload browser when you change the blade views.
Install the extension:
npm install laravel-mix-blade-reload
Or if you prefer yarn:
yarn add laravel-mix-blade-reload
Next require the extension inside your Laravel Mix config and call bladeReload()
in your pipeline:
// webpack.mix.js
const mix = require('laravel-mix');
require('laravel-mix-blade-reload');
mix.js('resources/js/app.js', 'public/js')
.bladeReload();
Works only when running HMR - Hot Module Replacement script (npm run hot
).
If nothing is passed to the extension inside your Laravel Mix config, the following options will be used:
{
path: 'resources/views/**/*.blade.php',
debug: false
}
path
(string or array of strings). Path to files, directories to be watched recursively, or glob patterns.debug
(boolean). Whenever to log extension event messages to the console.
- Now supports
laravel-mix
version 6
- Rewrited into TypeScript
- Option
paths
was renamed topath