How do I copy directories recursively with gulp?

后端 未结 4 1467
旧巷少年郎
旧巷少年郎 2020-12-04 06:44

I am trying to stage a project from a working directory to a server (same machine). Using the following code:

gulp.src([
    \'index.php\',
    \'css/**\',
          


        
4条回答
  •  悲哀的现实
    2020-12-04 07:02

    Turns out that to copy a complete directory structure gulp needs to be provided with a base for your gulp.src() method.

    So gulp.src( [ files ], { "base" : "." }) can be used in the structure above to copy all the directories recursively.

    If, like me, you may forget this then try:

    gulp.copy=function(src,dest){
        return gulp.src(src, {base:"."})
            .pipe(gulp.dest(dest));
    };
    

提交回复
热议问题