Skip to content

Simple module for running gulp tasks programattically, since `gulp.run` is deprecated.

Notifications You must be signed in to change notification settings

jonjaques/gulp-runner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gulp Runner

Simple module for running gulp tasks programattically, since gulp.run is deprecated.

Usage

var GulpRunner = require('gulp-runner');

// Runs path.resolve, but probably a good idea 
// to hand this a full filepath
var gulp = new GulpRunner('gulpfile.js');

Simple Callback

gulp.run('task', function(err) {
  // complete if no error
})

CLI Options

/* optional cli arguments (camelcased) */
var opts = {
  require: ['coffeescript', 'some-lib'],
  tasksSimple: true,
  production: true   // also accepts arbitrary flags 
                     // for use within your tasks
};

// equivalent of calling 
// gulp task1 task2 --require 'coffeescript' --require 'some-lib' --tasks-simple --production
gulp.run(['task1', 'task2'], opts, function(err) {
  // complete!
})

Event Emitter interface

Note: You can call run() many times with the same instance, but there will be no distinction between events. Best to use a new instance, or just pass an array of tasks.

// Need to bind your events before calling run()
gulp.on('start', function() {
  console.log('gulp starting...')
})

gulp.on('complete', function() {
  console.log('complete!')
})

gulp.on('log', function(data: Buffer) {
  // console.log(data.toString())
  // works better to 
  process.stdout.write(data);
})

gulp.on('error', function(err: Buffer) {
  process.stderr.write(err);
})

gulp.run('default')

About

Simple module for running gulp tasks programattically, since `gulp.run` is deprecated.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •