gulp.watch 包含从排除的目录中

  • 本文关键字:排除 watch 包含 gulp gulp
  • 更新时间 :
  • 英文 :


>我有以下代码,我想在其中排除资产目录中除名为 content 的子目录之外的所有文件。这是行不通的,因为!优先。有什么建议吗?

gulp.watch([
    '**/*',
    '!assets/**/*',
    'assets/content/**/*'
]);

因此,如果目录包含:

index.html
assets/
    content/
        index.html
    stylesheets/
        default.css

我想看:

index.html
assets/content/index.html

但不是:

assets/stylesheets/default.css

找到答案:

return gulp.watch(
    [ '**/*' ],
    { ignored: [
        'assets/**/*',
        '!assets/content/**/*',
    ] }
)

最新更新