Created
May 5, 2015 16:17
-
-
Save jameswomack/e6c017371cfd3461d39b to your computer and use it in GitHub Desktop.
Using Namespaces in Gulp 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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