My gulp code looks like this, partially
gulp.src(['../application-base/**/**.js', '!../application-base/assets/**/**.js'], { base: './' }) .pipe(gulpPlumber({ errorHandler: function (error) { console.log(`\nError ${error}`); this.emit('end'); } })) .pipe(gprint(filePath => "Transpiling: " + filePath.replace('..\\application-base\\', ''))) .pipe(babel({ compact: false })) .pipe(gulp.dest('../application-base-transpiled/')) .on('end', () => done());
If i change
.pipe(gulp.dest('../application-base-transpiled/'))
to
.pipe(gulp.dest(''))
then files with the extension are created and overwrite the originals. The problem is that
.pipe(gulp.dest('../application-base-transpiled/'))
does not save the file with the same source path in application-base-transpiled
As you can see, I am using a database that seems to work differently.
What am I missing?
EDIT
I looked more closely, and it seems even with
.pipe(gulp.dest('../application-base-transpiled/'))
Gulp still places the transferred files in the original location, overwriting the original. There is something about what I convey that gulp does not like, and ignores silently.
EDIT 2
Removing the base option seems to solve this problem, unlike the recommendations I saw elsewhere. The docs for gulp.dest don't really discuss this.
Can someone explain this?
EDIT 3
Reply Per Sven, I tried this
gulp.src(['**/**.js', '!assets/**/**.js'], { base: '../application-base' }) .pipe(gulpPlumber({ errorHandler: function errorHandler(error) { console.log('\nError ' + error); this.emit('end'); } })) .pipe(gprint(filePath => "Transpiling: " + filePath.replace('..\\application-base\\', ''))) .pipe(babel({ compact: false })) .pipe(gulp.dest('../application-base-transpiled/')) .on('end', () => done());
But it seems that the database is being ignored, and files from my current current directory are being captured and transferred to the place (the last thing I want - fortunately, GIT was useful for undoing the damage).
Is the base parameter used when using an array for src ?