【问题标题】:Gulp 4.0 Ignore watch not workingGulp 4.0 忽略手表不工作
【发布时间】:2015-11-23 10:43:37
【问题描述】:

我有以下代码:

 gulp.task('watch:Feature', function() {
        gulp.watch(['./js/Feature/**/*.ts', '!./js/Feature/.gulp-tsc-tmp*.ts'], function () { console.log("Test"); });
    });

我已将我的 typescript 构建任务替换为 console.log("Test"),并将名称为 .gulp-tsc-tmp-1151023-9976-e1a1h3.ts 的文件复制到 Feature 目录中,这会导致“测试”输出到控制台。

我尝试了各种排除模式,包括指定要复制到目录中的确切文件名,但似乎都不起作用。

忽略具有特定前缀的文件的正确方法是什么?

【问题讨论】:

    标签: gulp gulp-watch


    【解决方案1】:

    几周前我遇到了这个问题,并被告知该功能已被删除,我没有时间确定这是否属实,但我之前工作的“忽略”肯定没有一个正在更新版本。

    【讨论】:

      【解决方案2】:

      在 gulp 4 中忽略手表中文件的正确方法是:

      gulp.watch('js/Feature/**/*.ts', {
          ignored: 'js/Feature/.gulp-tsc-tmp*.ts'
      }, function () {
          console.log('Test');
      });
      

      the documentation

      【讨论】:

        【解决方案3】:

        我也遇到了这个问题,并通过从路径开头删除“./”来解决它:

        gulp.task('watch:Feature', function() {
            gulp.watch(['js/Feature/**/*.ts', '!js/Feature/.gulp-tsc-tmp*.ts'], function () { console.log("Test"); });
        });
        

        【讨论】:

          猜你喜欢
          • 2023-03-30
          • 1970-01-01
          • 1970-01-01
          • 2015-02-24
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多