I have gulp task to copy js files
This doesn't work
gulp.src('./**/*.js', {base: '../src/main/'})
.pipe(gulp.dest('../target/dist'));
This works:
gulp.src('../src/main/**/*.js', {base: '../src/main/'})
.pipe(gulp.dest('../target/dist'));
So whats the use of base here ? if i have to put whole path in first param, why should i use base ?
is there any official documentation about gulp src ? is it worth using gulp over grunt with limited documentation ?
[UPDATE BASED ON COMMENT]
Why am i using base ?
Please read this Looking for way to copy files in gulp and rename based on parent directory
and moreoever gulp.src can take array of paths so i would need base.
I have gulp task to copy js files
This doesn't work
gulp.src('./**/*.js', {base: '../src/main/'})
.pipe(gulp.dest('../target/dist'));
This works:
gulp.src('../src/main/**/*.js', {base: '../src/main/'})
.pipe(gulp.dest('../target/dist'));
So whats the use of base here ? if i have to put whole path in first param, why should i use base ?
is there any official documentation about gulp src ? is it worth using gulp over grunt with limited documentation ?
[UPDATE BASED ON COMMENT]
Why am i using base ?
Please read this Looking for way to copy files in gulp and rename based on parent directory
and moreoever gulp.src can take array of paths so i would need base.
Share Improve this question edited May 23, 2017 at 12:25 CommunityBot 11 silver badge asked Mar 27, 2014 at 0:07 Venkat ReddyVenkat Reddy 1,0521 gold badge8 silver badges13 bronze badges 1-
Why are you using
base
in the first place? It's not in the docs because it's not used except in special circumstances.gulp.src
is in the API docs,base
is documented viaglob-stream
. – OverZealous Commented Mar 27, 2014 at 2:25
2 Answers
Reset to default 21The use of .src()
is documented on the vinyl-fs github repo:
https://github./wearefractal/vinyl-fs
The base
property is used to determine the file names when saving in .dest()
.
I think you need to set the current working directory:
gulp
.src('./**/*.js', {cwd: '../src/main/'})
.pipe(gulp.dest('../target/dist'))
;
You should try to use 'root' param instead:
gulp.src('./**/*.js', {root: '../src/main/'})
.pipe(gulp.dest('../target/dist'));