Skip to content

Instantly share code, notes, and snippets.

@jameswomack
Created May 5, 2015 16:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jameswomack/e6c017371cfd3461d39b to your computer and use it in GitHub Desktop.
Save jameswomack/e6c017371cfd3461d39b to your computer and use it in GitHub Desktop.
Using Namespaces in Gulp 4
/*
* Gulp augmentation
*/
function getTasks(){
return gulp._registry._tasks;
}
function getTaskNamesInNamespace(namespace){
var tasks = getTasks();
var taskNames = Object.keys(tasks);
return taskNames.filter(function(taskName){
// It contains the namespace, but isn't the namespace itself
return taskName !== namespace && taskName.indexOf(namespace) === 0;
});
}
gulp.task('build:npm', gulp.parallel(getTaskNamesInNamespace('build:npm')));
gulp.task('build:styl', gulp.series(getTaskNamesInNamespace('build:styl')));
gulp.task('build:player', gulp.parallel(getTaskNamesInNamespace('build:player')));
gulp.task('build', gulp.parallel(['build:npm', 'build:css', 'build:images', 'build:player', 'build:styl']));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment