gulp-newer vs gulp-changed

前端 未结 3 1117
孤独总比滥情好
孤独总比滥情好 2020-12-08 04:42

What\'re the differences between them?

gulp-newer:

gulp.src(imgSrc)
  .pipe(newer(imgDest))
  .pipe(imagemin())
  .pipe(gulp.dest(imgDest));
<         


        
3条回答
  •  南笙
    南笙 (楼主)
    2020-12-08 04:52

    May I suggest gulp-newy in which you can manipulate the path and filename in your own function. Then, just use the function as the callback to the newy(). This gives you complete control of the files you would like to compare.

    This will allow 1:1 or many to 1 compares.

    newy(function(projectDir, srcFile, absSrcFile) {
      // do whatever you want to here. 
      // construct your absolute path, change filename suffix, etc. 
      // then return /foo/bar/filename.suffix as the file to compare against
    }
    

提交回复
热议问题