Skip to main content

Gulp is no longer the default choice for ASP.NET Core

Today when you create an ASP.NET Core application, you will find “gulpfile.js” present in your project structure (At the time of writing this post with RC2 release). However Microsoft is making a move with task runner and Gulp is no longer the default choice for ASP.NET Core application in a future release. It’s time to say “Goodbye Gulp“. And it is replaced with a new VS extension called BundlerMinifier. Gulp will be removed from default ASP.NET Core project template, but if you wish to use then, you can add it back. Earlier, an announcement was made about Project.json going away and now its turn for Gulp.

Goodbye Gulp for ASP.NET Core. But WHY?

This was announced a couple of days back. You can read here and here. But before we get into why, let’s first see why gulp was preferred.

Some History First…

When ASP.NET Core was introduced, Gulp was preferred over Grunt as default task runner choice. And there were many reasons.

  • Gulp was fast.
  • Gulp was starting to overtake Grunt in popularity.
  • Gulp has more downloads per day than Grunt.

And as Gulp was part of the project template so community and developers preferred it. Even I found Gulp lot easier to learn than Grunt. Gulp prefers code over configuration approach, which make things more efficient and manageable.

Why is it going?

Well, there is no reason given at this point of time. But rumors/assumptions are always there in the air. It seems that it is more of enterprise push-back. You can read the full thread here.
[Update: Reasons were pointed out in last week ASP.NET Community standup. And here is the summary.

  • With NPM and Gulp, publishing website takes a lot of time.
  • ASP.NET Core is a completely new system. So people have to learn ASP.NET Core and also Node, Grunt and Gulp. So the idea is to focus to learn only .NET Core.
  • File->New Project is very fast without NPM and Gulp as no package restore is required. And with NPM, there are 1500 files present in node_modules folder.
  • In previous versions of ASP.NET System.Web.Optimization is present for bundling and minification. So they want to bring the same experience.

Please watch the ASP.NET Community Standup video for more details.

And since Gulp is not going to be part of the default project template, many developers may not use it and move to BundlerMinifier. That’s how Microsoft forces developers to use their choice, instead of caring about web community’s preferences.

How to use BundleMinifier?

To use this extension, download the VS extension and install it. Once this is installed, you are good to use it. Create an ASP.NET Core project and when you right-click on .css file, you should see an option “Minify CSS”.

BundleMinifier-Minify CSS

And you should see “site.min.css” created and “bundleconfig.json” will be added to your project structure. And same option will be available when you right-click on single .js file. Following is the content of bundleconfig.json.

[
  {
    "outputFileName": "wwwroot/css/site.min.css",
    "inputFiles": [
      "wwwroot/css/site.css"
    ]
  },
  {
    "outputFileName": "wwwroot/js/site.min.js",
    "inputFiles": [
      "wwwroot/js/site.js"
    ]
  }
]

And when you select multiple js files and right-click on it, then you will see “Bundle and Minify files” option.

BundleMinifier-bundle-minify js

Visit this page to get all the details about this extension. You can visit github to take a look at this code. You may find some issue while using this extension. Like, I didn’t get this option “Enable bundle on build” as pointed here.

Enable Bundle on Build

However these are early days for this extension and over the period of time, I hope it will become better and better.

Summary

Well, I must tell you this change will not be appreciated by the community. Gulp is a great tool and it has great community support. But who cares? Since the new extension is going to part of the new project template, so it will be preferred. But who knows, this could be good move as well. It’s not that everything Microsoft is backing is bad. TypeScript is an awesome example. It is used a lot and in fact Angular2 is written in TypeScript. So let’s keep our finger crossed and hope for the best!!!!!

Thank you for reading and I hope it helped you. Keep visiting this blog and share this in your network.

PS: If you found this content valuable and want to return the favour, then Buy Me A Coffee

3 thoughts to “Gulp is no longer the default choice for ASP.NET Core”

Leave a Reply

Your email address will not be published. Required fields are marked *