In laravel 5.4 mix and browserSync are coming by default. I want to get my browser refreshed with new changes if I modify any *.blade.php
files from resources/views
. In my webpack.mix.js
I have got this configuration:
const { mix } = require('laravel-mix');
mix
.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css')
.browserSync({
proxy:'localhost',
port:8000,
files: {
match: [
"resources/views/**/*.blade.php",
"public/css/*.css",
"public/js/*.js",
],
fn: function (event, file) {
/** Custom event handler **/
},
options: {
ignored: [
'*.txt',
'*.json'
]
}
},
logPrefix:'L54',
});
I dont' know if I am doing right, or maybe I have to set up Mix configuration or so. Any help would be much appreciated.
Just for anyone still wondering, this seems to work on Laravel 5.5 (development branch):
mix.browserSync({
proxy: 'https://www.site.example',
files: [
'./resources/views/**/*.blade.php',
]
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With