浏览器同步,从gulp 3.x迁移到gulp 4.x时,脚本和样式重新加载不起作用

问题描述 投票:0回答:1

我正在尝试将gulp从3.x升级到4.x使用gulp watch时,样式,脚本和注入功能可以很好地工作,但是当我进行任何文件更改时,脚本和样式都需要自动加载。这不起作用。

我尝试将gulp.series添加到每个函数中。

    function isOnlyChange(event) {
      return event.type === 'changed';
      }

   gulp.watch([
     path.join(conf.paths.src, '/app/**/*.css'),
     path.join(conf.paths.src, '/app/**/*.scss')
    ], gulp.series(function (event) {
        if (isOnlyChange(event)) {
          gulp.series('styles-reload');
       } else {
         gulp.series('inject-reload');
       }
   }));

当我在样式文件中进行更改时,Gulp手表需要重新加载样式,但是此操作无法执行。有人可以帮我解决在gulp 4.x中的表现吗

gulp gulp-watch gulp-browser-sync
1个回答
0
投票

您可以尝试这样的事情:

© www.soinside.com 2019 - 2024. All rights reserved.