简体   繁体   中英

Laravel “gulp watch” compiles assets automatically but doesn't reload the browser

I am running gulp on a laravel 5.3 and it seems that gulp watch runs and sync via browsersync only once. Whenever I made changes on my scripts, assets are being compiled automatically but the browser doesn't reload.

Here's my gulpfile.js

const elixir = require('laravel-elixir');
const browserSync = require('laravel-elixir-browsersync');

elixir(mix => {
    mix.browserSync({
        proxy: 'local.app'
    });

    // these files are located under [resources/assets/app/css/..] that will be compiled to [public/app/css/...]
    mix.styles([
        '../app/css/bootstrap.min.css',
        '../app/css/animate.css',
        '../app/css/style.css'
    ], 'public/app/css/plugins.min.css');
});

I checked http://localhost:3001/ and everything is enabled on the browserSync settings.

Make sure that local.app is accessible in your browser. Since you are testing on localhost and not on the name: local.app . If that's not the solution you can try this:

mix.browserSync({
   proxy: 'local.app',
   files: ['public/**/*.css', 'resources/**/*']
 });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM