Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bundling and Minification in MVC 6

It looks like Bundling and Minification are no longer built into MVC 6 since there is no more App_Start and Bundle.Config.

Is this going to be the case after final release?

I'm guessing Grunt should be used since that seems to be baked into Visual Studio 2015.

UPDATE: It looks like Microsoft has switched to Gulp instead of Grunt in RC1.

like image 893
RickJames Avatar asked Feb 11 '15 13:02

RickJames


People also ask

What is minification and bundling in MVC?

Bundling and minification are two techniques you can use in ASP.NET 4.5 to improve request load time. Bundling and minification improves load time by reducing the number of requests to the server and reducing the size of requested assets (such as CSS and JavaScript.)

What is bundling in MVC with example?

Bundling allows us to load the bunch of static files from the server in a single HTTP request. The following figure illustrates the bundling technique: Loading script files in separate requests. In the above figure, the browser sends two separate requests to load two different JavaScript file MyJavaScriptFile-1.

What is the advantage of bundling in MVC?

The MVC provides us the two features to reduce the number of requests to access the resource file on the server i.e. Bundling and Minification. Bundling is one of the features of MVC. By implementing this, we can improve performance request load time.

How bundling and minification works in .NET core?

What is bundling and minification. Bundling and minification are two distinct performance optimizations you can apply in a web app. Used together, bundling and minification improve performance by reducing the number of server requests and reducing the size of the requested static assets.


1 Answers

Bundler & Minifier Extension

The default ASP.NET Core MVC 6 project template uses a Bundler & Minifier extension. The default template used to use Gulp which was far more powerful but it was deemed too complex for newbie developers who wanted something simple. You can read more about the switch away from Gulp and the reasoning here or read the documentation for the Bundler & Minifier extension here.

WebPack, Gulp, Grunt, Brocoli, etc.

A much nicer and far more powerful method is to use Gulp, or any other task runner (There are others named Grunt, Brocoli etc. Gulp is apparently nicer to work with and newer than Grunt but also more popular than Brocoli). You can use the ASP.NET MVC Boilerplate project template to get a project with Gulp built in.

The new kid on the block is called WebPack which is according to Google about as popular as Gulp at the moment.

ASP.NET MVC 5 Bundling and Minification and Smidge

The old bundling and minification in ASP.NET MVC 5 has been dropped but there is a project on GitHub to build it for MVC 6 called Smidge.

like image 154
Muhammad Rehan Saeed Avatar answered Sep 25 '22 08:09

Muhammad Rehan Saeed