Now that we have all the required tools installed, we need to create our gulpfile.js. So Add a New Item how ever you choose and name it gulpfile.js. If you are following along, your file structure should look similar to this:

I have an empty gulpfile.js now what?

Open your newly created gulpfile.js and start setting up the tools, starting with Gulp.

On a side note I have added the static files dependency, an index.html inside the wwwroot and a src folder to hold my source files. For more information on how this can be done see my previous post ASP.NET 5 and Static Files

Now that you have the beginning of your gulpfile.js we should create a few things we might want to concatenate and minify and a SCSS style sheet that needs to be converted to CSS. I will create 2 JavaScript files, one named alert.js and the other names delay.js and one SCSS file names styles.scss.

style.scss

But I only want one JavaScript file

Back in your gulpfile.js we are going to create a task to concatenate the JavaScript files. In gulp terms a task is a function you assign a name, declare dependencies and define the function it will preform. Tasks can require other tasks to be accomplished before they are executed, allowing you to build complex build processes one little task at a time. Dependencies are optional and since this is a pretty simple process I will omit the array that represents them this time.

gulp.task('javascript', function () {
// do work here
});

This is pretty straight forward so far. I have created a task named ‘javascript’ and given it a function that does nothing. I will add the following lines in place of // do work here