I want gulp.src to include all file and folders in src directory, except for src/devpackages directory, so that the src/devpackages directory is not copied with gulp.dest. How can I do that? I tried with gulp.src(['src/**/*', '!src/devpackages/**']), but the gulp.dest creates the src/devpackages, but leaves it empty.
Asked
Active
Viewed 162 times
-1
Victor Mukherjee
- 10,487
- 16
- 54
- 97
-
1Possible duplicate of [Excluding files/directories from Gulp task](http://stackoverflow.com/questions/23384239/excluding-files-directories-from-gulp-task) – Sven Schoenung Nov 08 '16 at 09:16
-
@SvenSchoenung I am not asking for any rjs thing, I am asking for gulp.src. Please see the edit and let me know if you can help. – Victor Mukherjee Nov 08 '16 at 09:26
-
1The linked question is not an "rjs thing". The accepted answer explains how to use ignore patterns in `gulp.src()`. – Sven Schoenung Nov 08 '16 at 09:30
2 Answers
1
gulp.src([
baseDir + '/**', // Include all
'!' + baseDir + '/src/devpackages{,/**}', // Exclude devpackages
], { dot: true });
BigBazooka007
- 107
- 12
0
See the discussion here : [excluding folders from globs][1]. You can do it by this:
gulp.src(['src/**/*', '!src/devpackages{,/**}'])
That is shorthand for exclude the folder and exclude the files it contains, you need to do both.
[EDIT] Oops, sorry - I missed that the previous answer had this idea already (although a little over-complicated).
Mark
- 143,421
- 24
- 428
- 436