Browsersync + gulp无法连接我的浏览器

时间:2018-10-08 10:53:55

标签: gulp browser-sync

我有两个项目使用Gulp + browsersync来更改文件后重新加载。一切都很好,直到我有了另一台PC并开始将开发环境迁移到新计算机上。然后我的项目配置之一突然不起作用了。

在这里配置:

gulp.task('default', ['serve']);

gulp.task('serve', [(argv.api || 'mock') + ':api', 'lint', 'test'], function() {
  browserSync.init({
    proxy: "localhost:3003"
  });

  gulp.watch(paths.templates_files).on('change', browserSync.reload);
  gulp.watch(paths.templates_dir).on('change', browserSync.reload);
  gulp.watch(paths.message_files).on('change', browserSync.reload);
  gulp.watch(paths.scripts_files).on('change', browserSync.reload);
  gulp.watch(paths.sass_styles_files, ['sass']);
  gulp.watch(paths.styles_files).on('change', browserSync.reload);

  gulp.watch(
    paths.scripts_files.concat(paths.test_scripts_files),
    ['lint', 'test']);
});

我不确定它有什么问题,因为它曾经可以工作。所以我看一下我的页面元素:

enter image description here

异步脚本已成功注入,但没有已连接到浏览器同步警报。我试图打开BrowserSync用户界面,然后依次按 New标签全部重载

enter image description here

令人惊讶的是,即使打开了新的标签页,在此之后它们实际上都没有重新加载。

0 个答案:

没有答案