为什么我的gulp src会忽略使用"!"

时间:2015-08-10 16:10:53

标签: gulp

我的gulp脚本忽略了我在src中的排除。

gulp.src([
  srcPath + name + '/.env', 
  srcPath + name + '/**/bin/*', 
  '!' + srcPath + name + '/dist', 
  srcPath + name + '/node_modules', 
  srcPath + name + '/**/*.js', 
  '!' + srcPath + name + '/config'
])

但它仍然包括srcPath + name +' / dist'文件,即使我用那个标记路径!排除文件。

1 个答案:

答案 0 :(得分:1)

!放在最后,它会起作用(这是我见过的最反直觉的事情之一)。我假设srcPathname是正确的。

gulp.src([
  srcPath + name + '/.env', 
  srcPath + name + '/**/bin/*', 
  srcPath + name + '/node_modules', 
  srcPath + name + '/**/*.js',
  '!' + srcPath + name + '/dist', 
  '!' + srcPath + name + '/config'

])