caseyhoward/pipe-dream

Support gulp-load-plugins functionality

caseyhoward opened this issue · 0 comments

pipe-dream handles most use cases of gulp-load-plugins right now. Here's an example from the gulp-if README

var gulpif = require('gulp-if');
var uglify = require('gulp-uglify');

var condition = true; // TODO: add business logic

gulp.task('task', function() {
  gulp.src('./src/*.js')
    .pipe(gulpif(condition, uglify()))
    .pipe(gulp.dest('./dist/'));
});

With gulp-load-plugins, it would look like this:

var $ = require('gulp-load-plugins');

var condition = true; // TODO: add business logic

gulp.task('task', function() {
  gulp.src('./src/*.js')
    .pipe($.if(condition, $.uglify()))
    .pipe(gulp.dest('./dist/'));
});

However, with pipe-dream, it should look like this:

var $ = require('pipe-dream');

var condition = true; // TODO: add business logic

gulp.task('task', function() {
  $('./src/*.js')
    .if(condition, $.uglify())
    .dest('./dist/');
});

However, $.uglify is not supported. The easiest idea I can think of is to do what gulp-load-plugins does and load every plugin in the package.json file. However, this doesn't solve the auto-installing issue. I'm not really sure exactly how to do that since it's asynchronous.