O
O
Oleg2016-11-09 20:17:53
gulp.js
Oleg, 2016-11-09 20:17:53

How to declare all plugins in gulpfile.js with 1 require?

I heard somewhere that some advanced progers do this. But I still don't understand how to do it? And is it necessary? Is it an alternative to gulp-load-plugins and will it give me a speed boost?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg, 2016-11-09
@werty1001

You can make an additional wrapper so that everything does not load every time:

var task = function(name, path, options) {
  options = options || {};
  return gulp.task(name, function(cb) {
    var call = require(path).call(this, options);
    return call(cb);
  });
};

Read more here

N
NoMoney, 2016-11-10
@NoMoney

But... gulp-load-plugins uses lazy loading.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question