koltyakov / generator-sppp

🐾 SP Pull-n-Push - Yeoman generator for SharePoint client-side applications
MIT License
64 stars 12 forks source link

Where are the gulp tasks? #30

Closed kunalkankariya closed 5 years ago

kunalkankariya commented 5 years ago

This is a question and not an issue

The gulpfile.js doesn't list the tasks individually. So, where are they defined? and how does gulp know what to do when I say gulp push for instance. I know the npm scripts invokes this but where is the definition for gulp push ( I know its spsave under the hood).

Thanks!

koltyakov commented 5 years ago

There are plenty of tasks spread throught the different modules. All they are defined in sp-build-tasks and registered in gulpfile.js:

new (require('sp-build-tasks').SPBuildTasks)(gulp, {
  privateConf: process.env.PRIVATE_JSON || './config/private.json',
  appConfig: process.env.APP_JSON || './config/app.json',
  taskPath: process.env.TASKS_PATH || './tools/tasks'
});

Also, you can define custom tasks. When scaffolding, there is the corresponding option. Which adds example.js in ./tools/tasks folder.

//@ts-check

const { customTask } = require('sp-build-tasks');

module.exports = customTask((gulp, $, settings) => {

  gulp.task('example', cb => {
    console.log('Example Gulp Task');
    cb();
  });

});

Hope you got the idea.

koltyakov commented 5 years ago

Going to close it.

kunalkankariya commented 5 years ago

Thank you so much :)