Friday, 19 May 2017

What does a .pipe() function return in gulp?

In the following snippet, what will be the input to and output of .pipe(gulpIf('*.css', cssnano())) ?

gulp.task('useref', function(){
  return gulp.src('app/*.html')
    .pipe(useref())
    .pipe(gulpIf('*.js', uglify()))
    .pipe(gulpIf('*.css', cssnano()))
    .pipe(gulp.dest('dist'))
}); 

API docs (link) says .pipe(destination) returns a reference to the destination stream for setting up chain, if so .pipe(gulpIf('*.js', uglify())) will return a stream to a minified .js file, how can it be piped to .pipe(gulpIf('*.css', cssnano())) ?



via Alok Mishra

No comments:

Post a Comment