gulp-newer vs gulp-changed

前端 未结 3 1114
孤独总比滥情好
孤独总比滥情好 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 05:11

    In order to answer this question you will have to compare both plugins source code.

    Seems that gulp-changed has more options as you have said, more used (it was downloading more time) and more contributors, thus, it could be more updated and refactored, as it was being used more.

    Something that can make a difference, due to them documentation.

    On the example, for gulp-newer, its used like this:

    gulp.task('default', function() {
      gulp.watch(imgSrc, ['images']);
    });
    

    Thus, seems that once this task is running, it will only notice files that are changing while you are using this plugin.

    On gulp-changed, they say: "will only get the files that changed since the last time it was run". So, and I didnt try this on a working example, that gulp-changed proccess all files and then only the ones that have been changed since last execution, so seems it will always "look" at all files and internally (md5 hash? no clue, didnt check the source) decide whereas a file has changed since last execution. Do not need a watcher for that.

    All this, was only reading their official documentation.

    A "on the wild test" would be very welcomed !

提交回复
热议问题