Skip to content

Instantly share code, notes, and snippets.

@andfaulkner
Created August 28, 2015 09:34
Show Gist options
  • Select an option

  • Save andfaulkner/087a1ab9a2be30044263 to your computer and use it in GitHub Desktop.

Select an option

Save andfaulkner/087a1ab9a2be30044263 to your computer and use it in GitHub Desktop.
Gulp task that lists all gulp tasks registered (excluding built-ins 'install' and 'uninstall')
require('colors');
gulp.task('get-tasks', () =>
(process.nextTick(() => {
console.log('\n_________ALL REGISTERED GULP TASKS_________');
Object.keys(gulp.tasks).forEach((t) =>
((t === 'install' || t === 'uninstall') ? null :
console.log('-- ' + t.bgBlack.green)))
console.log('___________________________________________\n');
})));
// requires you to have done this in the project root first:
// npm install colors --save-dev
@pilniczek
Copy link

A little update for gulp v4 with babel

const tasksTask = gulp =>
	process.nextTick(() => {
		console.log("┌─────────────────────────────────────────┐");
		console.log("│        ALL REGISTERED GULP TASKS        │");
		console.log("├─────────────────────────────────────────┤");
		Object.keys(gulp.registry().tasks()).forEach(t => {
			if (t !== "install" && t !== "uninstall") {
				let nameRow = "│ " + t;
				for (let i = 0; i < 40 - t.length; i++) {
					nameRow += " ";
				}
				nameRow += "│";
				console.log(nameRow);
			}
		});
		console.log("└─────────────────────────────────────────┘");
	});

export { tasksTask };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment