I have a problem when I try to overwrite a file with gulp. To make you understand my problem here's an example of what I am trying to do: My project file path:
- Project
|- clients
|- clientBase
|- JS
|- jsexample.js
|- jsexample2.js
|- CSS
|- HTML
|- client1
|- JS
|- jsexample2.js
|-dist
dist
.const args = require('yargs').argv;
const src = {
base: './Project/clients/clientBase',
client: `./Project/clients/${args.client}`,
};
const dist = './Project/dist';
const runSequence = require('run-sequence');
gulp.task('copy:base', function(){
return gulp
.src(`${src.base}/**/*`)
.pipe(gulp.dest(dist))
});
gulp.task('copy:client', function(){
return gulp
.src(`${src.client}/**/*`)
.pipe(gulp.dest(dist))
});
gulp.task('copy', function(){
if (args.client) {
runSequence('copy:base', 'copy:client');
} else {
runSequence('copy:base');
}
});
The problem is that the dist files are not being overwritten by the copy:client
task.
I've checked the file path and the content inside the files. The argument client
is being passed to, so this task is being executed.
After some more research, I noticed that in my task sequence chain in the default task
, there was another task copying again the base code, without any logging.