Now, we’ll see that the site.css and site.js files each have a minified version.
It follows that running the default “clean” would remove those minified files.
Binding Tasks to Events
I mentioned at the beginning of this post that you can bind these tasks to run during certain Visual Studio events. Any task can run during any event, and each task can run during multiple events. The events we can bind Gulp.js tasks to are:
- Before Build
- After Build
- Project Open
We can bind tasks to events by using the interface (right-click the task you want to bind):
You can also do it directly by modifying the binding code in the gulpfile.js:
/// <binding BeforeBuild='min, clean' Clean='clean' />
The integration of Gulp.js into Visual Studio 2015 makes managing JS, CSS, and HTML files much simpler. We can create tasks for common operations like bundling and minification, and those tasks can now automatically be run as part of events like Clean or After Build. All-in-all, Task Runners like Gulp.js bring Visual Studio and ASP.NET Core just another step closer to being the best IDE and project stack out there. Of course, I might be just a little biased.
Did this help, or did I miss something about Gulp.js or Task Runners that you found useful? Need to yell at me because you’re frustrated and no one else is around? Sound off in the comments!