This small snippet below attempts to copy two projects, projA
and projB
from their folders into the gulp folder. It passes the paths for the two folders via an array. The code executes correctly but only the last path in the array. So only projB
is copied over.
`const gulp = require('gulp');`
`var pathsToProj = [ // source // base destination
['../../projA/eb_aws/**/*.*', 'projA/eb_aws', 'gulp-proj1/src/projA/eb_aws'],
['../../projB/eb_aws/**/*.*', 'projB/eb_aws', 'gulp-proj1/src/projB/eb_aws'],
];
pathsToProj.forEach(pathToProj => {`
gulp.task('copyFiles', function(){
return gulp.src(pathToProj[0], {base: pathToProj[1]})
.pipe(gulp.dest(pathToProj[2]));
});
gulp.task('default', gulp.series('copyFiles', async function (cb){
cb();
}));
});
Another anomaly is that the project folder is copied to /gulp-proj1/
(/gulp/proj1/projB
) and not to /gulp-proj1/src/
as I intended it to be.
Any help to resolve this is appreciated. Thanks.