How does gulp monitor the status of gulp.dest file copy completion?

After the

copy task is completed, the files in the proDir will be manipulated later. However, subsequent operations often fail because the copy of the file has not been completed.
how should I monitor the status of the completion of the dest copy?

gulp.task("copy",["clear"],function(cb){
    const dirs = getFolders(srcDir)
    dirs.map( (dir,index) =>{
        const commons = gulp.src([devDir,`!${path.join(__dirname, "../dev/config.js")}`,`!${path.join(__dirname, "../dev/project.config.json")}`])
        const configs = gulp.src(path.join(srcDir,dir,"/**"))
        return merge(commons,configs).pipe(gulp.dest(path.join(proDir,dir)))
    })
})
Mar.03,2021

you can listen to finish events, and then do subsequent operations


gulp itself executes tasks in no order. It is recommended that you install gulp-sequence and check the npm official website, which is a plug-in that can define the order of gulp execution

.
Menu