This got me more interested in Gulp and I started exploring how can I further improve my debugging and build workflow with Gulp. After spending some more time, I came up with a basic workflow which will definitely get you interested in Gulp as a SharePoint/Office 365 Developer!
Here is my project on GitHub: https://github.com/vman/SP-Simple-Gulp-Demo
The plugins used in this demo are:
gulp-concat : Used to bundle js files.
gulp-uglify : Used to minify the js files
gulp-rename : Used to rename the minified file to .min.js
gulp-spsave : Used to upload files to SharePoint
Here is the file structure of my Visual Studio 2015 project. It is a simple ASP.NET project where I have removed all unnecessary files. Since this is a strictly front-end/UI project, you could also open a folder in Visual Studio as described in this StackOverflow post.
The Output folder is where my output files GulpDemo.js and GulpDemo.min.js will be created. These will also be uploaded to SharePoint.
The GulpFile.js is where all my Gulp tasks will be defined.
The package.json file is where all the NPM packages required for my tasks will be defined.
So without further ado, here is the code for my Gulp tasks:
After creating your gulp tasks, you can run them from the Task Runner Explorer window in Visual Studio 2015:
Thanks for reading!