// Create an instance of `Composer`
const Composer = require('{%= name %}');
const composer = new Composer();
// Define tasks with the .task() method
composer.task('foo', callback => {
callback(); // do stuff
});
composer.task('bar', callback => {
callback(); // do stuff
});
composer.task('baz', ['foo'. 'bar']);
// Run tasks with the .build() method
composer.build('baz')
.then(() => console.log('done!'))
.catch(console.error);
{%= apidocs("lib/tasks.js") %}
{%= apidocs("lib/generator.js") %}
app.on('task', function(task) {
switch (task.status) {
case 'starting':
// Task is running
break;
case 'finished':
// Task is finished running
break;
}
});
Emitted after a task is registered.
Emitted when a task is preparing to run, right before it's called. You can use this event to dynamically skip tasks by updating task.skip
to true
or a function.
See the changelog.