In ASP.NET 5 Bundling and Minification will not be handled by Visual Studio. To achieve the same results as was possible with the ASP.NET of yesteryear (or earlier today if that’s your thing) a build process like Grunt or Gulp will be necessary. With the Task Runner Explorer that is included with Visual Studio 2015, it is possible to assign predefined tasks to run at certain points during your build process. To make effective use of the new (to .NET) way of doing things; getting an understanding of either Gulp or Grunt will be necessary.
What’s Gulp again?
Gulp has 4 things that it can do:
task is used to define a function that can be called by other functions as a dependency or can be invoked directly.
src is used to get files to use in a stream.
dest is used as a destination for the stream you are working with and will save files.
watch is used to specify a file or group of files to monitor for changes and perform a task or tasks when a change occurs.
More details about the gulp functions can be found in the gulp docs.
Do what now?
If you are using Visual Studio 2015 a copy of Node.js should have be installed for use unless you opted out of it. If you need to to get Node.js go to https://nodejs.org/ and use the big ‘Install’ button, follow directions from there.
To get Gulp open a console at your project level and type
npm install -g gulp like so:
C:workspacegulp>npm install -g gulp C:UsersBrettAppDataRoamingnpmgulp -> C:UsersBrettAppDataRoamingnpmnode_modulesgulpbingulp.js email@example.com C:UsersBrettAppDataRoamingnpmnode_modulesgulp ├── firstname.lastname@example.org ├── email@example.com ├── firstname.lastname@example.org ├── email@example.com ├── firstname.lastname@example.org (email@example.com) ├── firstname.lastname@example.org (email@example.com) ├── firstname.lastname@example.org ├── email@example.com (firstname.lastname@example.org, email@example.com, firstname.lastname@example.org, email@example.com, firstname.lastname@example.org) ├── email@example.com ├── firstname.lastname@example.org (email@example.com, firstname.lastname@example.org, email@example.com) ├── firstname.lastname@example.org (email@example.com, firstname.lastname@example.org, email@example.com, firstname.lastname@example.org) ├── email@example.com (firstname.lastname@example.org, email@example.com, firstname.lastname@example.org, email@example.com, firstname.lastname@example.org, lo email@example.com, firstname.lastname@example.org, email@example.com, firstname.lastname@example.org, email@example.com, firstname.lastname@example.org, email@example.com, firstname.lastname@example.org, email@example.com) └── firstname.lastname@example.org (email@example.com, firstname.lastname@example.org, email@example.com, firstname.lastname@example.org, email@example.com, firstname.lastname@example.org, glob -email@example.com, firstname.lastname@example.org)
This was the unedited response from the command. I’m going to remove some of the unnecessary feedback from the console output from here on out.
Wait a bit for the install and then install Gulp locally
npm install --save-dev gulp:
C:workspacegulp>npm install --save-dev gulp email@example.com node_modulesgulp ... C:workspacegulp>
npm install --save-dev gulp-sass gulp-concat gulp-uglify to install all three at once, like this:
C:workspacegulp>npm install --save-dev gulp-sass gulp-concat gulp-uglify / > firstname.lastname@example.org install C:workspacegulpnode_modulesgulp-sassnode_modulesnode-sass > node scripts/install.js > email@example.com postinstall C:workspacegulpnode_modulesgulp-sassnode_modulesnode-sass > node scripts/build.js `win32-x64-node-0.12` exists; testing Binary is fine; exiting firstname.lastname@example.org node_modulesgulp-concat ... email@example.com node_modulesgulp-uglify ... firstname.lastname@example.org node_modulesgulp-sass ... C:workspacegulp>
In the output, you can see that the 3 distinct installs occurred.
Fade to back, roll credits….
Ok, just kidding. Continue your adventures with Visual Studio 2015 CTP 6 and Gulp Episode II: First Task.