Skip to content

Commit

Permalink
lazily require gulp
Browse files Browse the repository at this point in the history
enables usage only with externally provided gulp module
  • Loading branch information
Frizi authored and pgrabarz committed Apr 22, 2015
1 parent d126354 commit 1a26e91
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ function verifyTaskSets(gulp, taskSets, skipArrays) {
}

function runSequence(gulp) {
// load gulp directly when no external was passed
if(typeof gulp === 'undefined') {
gulp = require('gulp');
}

// Slice and dice the input to prevent modification of parallel arrays.
var taskSets = Array.prototype.slice.call(arguments, 1).map(function(task) {
return Array.isArray(task) ? task.slice() : task;
Expand Down Expand Up @@ -85,7 +90,7 @@ function runSequence(gulp) {
runNextSet();
}

module.exports = runSequence.bind(null, require('gulp'));
module.exports = runSequence.bind(null, undefined);
module.exports.use = function(gulp) {
return runSequence.bind(null, gulp);
};
};

0 comments on commit 1a26e91

Please sign in to comment.