简体   繁体   中英

Gulp.js Ignoring source Control Files

I have a project structure some thing like:

web
   a.html
   CVS
   folderA
          b.html
          CVS
   c.html

I am trying to use gulp to copy src to dest However i want to ignore all CVS folders [souce control] in all levels. Tried gulp-filter or !{dir} at src, nothing works...

Here is my gulpfile.js code for the same:

Doesnt work:

 gulp.task('default', function() {
 gulp.src([myDir+'/**'])
.pipe(filter(['*', '!'+myDir+'/CVS/**']))
.pipe(gulp.dest(jboss_dir));
 });

Nor Does this:

 gulp.task('default', function() {
 gulp.src([myDir+'/**', '!'+myDir+'/CVS/**'])
 .pipe(gulp.dest(jboss_dir));
 });

Two issues:

  1. You're only excluding the top level CVS folder. To exclude any folder/subfolder named CVS , you need to use '!' + myDir + '/**/CVS/**' '!' + myDir + '/**/CVS/**' .
  2. CVS/** will select all the contents of a CVS folder, but not the folder itself. If you want to exclude both the folder and its contents, do it explicitly: '!' + myDir + '/**/CVS', '!' + myDir + '/**/CVS/**' '!' + myDir + '/**/CVS', '!' + myDir + '/**/CVS/**' '!' + myDir + '/**/CVS', '!' + myDir + '/**/CVS/**' .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM