copying files with gulp

后端 未结 2 1982
清歌不尽
清歌不尽 2021-01-17 18:11

I have an app. My app source code is structured like this:

./
  gulpfile.js
  src
    img
      bg.png
      logo.png
    data
      list.json
    favicon.ic         


        
2条回答
  •  生来不讨喜
    2021-01-17 18:52

    You can create separate tasks for each target directory, and then combine them using a general "copy-resources" task.

    gulp.task('copy-img', function() {
      return gulp.src('./src/img/*.png')
        .pipe(gulp.dest('./deploy/imgs'));
    });
    
    gulp.task('copy-data', function() {
      return gulp.src('./src/data/*.json')
        .pipe(gulp.dest('./deploy/data'));
    });
    
    gulp.task('copy-resources', ['copy-img', 'copy-data']);
    

提交回复
热议问题