Gulp workflow document output problem?

  node.js, question

gulpfile.js

var gulp = require('gulp');
 
 var cssSprite = require('gulp-css-spritesmith');
 
 //Mosaic Sprite Chart
 gulp.task('sprites', function () {
 gulp.src('./output/css/*.css')
 .pipe(cssSprite({
 imagepath: './output/imgs/slice/',
 spritedest: './output/imgs/sprite/',
 spritepath: '../imgs/sprite/'
 }))
 .pipe(gulp.dest('./'));
 });
 
 //File Move
 gulp.task('moveFile',function(){
 gulp.src('./public/css/*')
 .pipe(gulp.dest('./output/css/'));
 gulp.src('./public/imgs/*/*')
 .pipe(gulp.dest('./output/imgs/'));
 
 })
 
 gulp.task('build',['moveFile','sprites']);

directory structure

clipboard.png

Sample code

The expected effect is to first move the css folder and the imgs folder to the output folder and then generate the sprite map. At present, the problem is that the file has been successfully moved, but the sprite map has not been generated. The sprite map must be generated by executing gulp build again.

Looks like yoursspritesThe task should depend onmoveFileTask
There is a related problem:https://segmentfault.com/q/1010000003038517

gulp.task(name[, deps], fn)
depsTasks in will be executed before name, whiledepsAll the tasks insideDefaultYesMaximum parallel execution.

Therefore, we might as well try the topic, link the one inside said, and add a dependency to the following tasks.