Custom Gulp tasks in SharePoint Framework (SPFx) Solution

Hi Friends,

There are many scenarios where we need some custom task to be performed and would prefer to perform that task as automation process. A very good example that i remember right now is the updating the version in the config.json before creating the package. It is very common to forget to update the package and then we need to build the solution again as the changes will not reflect if the version is not increased..
So here I'll guide how you can create our own gulp task and make most of the work automated by writing simple commands.

I this example i will be updating the minor version if the mode is debug else major version will be updated. Secondly, if the build is SHIP then it will compile and also build the packages. So in short you only need to execute a single command to perform all the actions at once.

The below code creates a task by the name 'createPackage' and describes the execute command

Happy Coding 🎺
Sumit Kanchan


Popular posts from this blog

SharePoint Image Gallery

SharePoint Framework (SPFx) : Cascade dropdown in webpart properties

Checking user permission in SharePoint Framework (SPFx) webpart