Building high-performance and responsive web applications are important for a developer. It allows the developer to showcase their ability to build dynamic solutions and ensure a seamless customer experience.
We have transitioned from simple HTML pages to more complex pages with a variety of dynamics added with different business logic. Developers utilize two development concepts for building performant web applications;
In this guide, we will explain how to implement these development techniques in ASP.NET Core 3.0, starting with an overview of the same.
What is Bundling?
What is Minification?
The purpose of minification is to make the code cleaner and tidy. The process herein includes removing unnecessary spaces, comments, characters, and so on. These elements increase the code and file size, but effectively removing them improves the code structure without affecting functionality.
To execute these functions, the developers can use the BundlerMinifier tool in Visual Studio. The BundlerMinifier works as an extension. The functionality of the tool is simple, effective. And It will integrate with an ASP.NET Core project, which is our primary topic today.
Here’s the Process to Use the BundlerMinifier Extension;
Step 1: Open Visual Studio 2017 or 2019 and navigate to Extensions followed by selecting Manage Extensions.
Step 2: When a new window opens, go to Search BundlerMinifier. Download & Install it, followed by restarting the Visual Studio software. In search type bundler & minifier, click on download and install. It will ask you to close Visual Studio and then install the extension. Once installed, click on Modify to start using the extension.
Step 3: Open Visual Studio after installing the extension and open the project you want to work on. Once opened, click on the www-root folder and select the CSS file that you want to minify or bundle.
Right-click on the file and select Bundler & Minifier. From the pop-up that shows click on Minify file, you will have a minified file with no unnecessary spaces, comments, etc.
At the same time, you can also generate a bundleconfig.json file in your project.
The bundleconfig.json file is a standard JSON file. It is easy to understand as every bundle in the file is named as with the “outputFileName” field, and the “inputFiles” to be bundled into that output are simply an array of files.
If you click the ‘Enable bundle on build’ context menu item, then Visual Studio will download an additional NuGet package that has not already installed.
When both techniques implement in the development environment, it makes building a solution easier. That’s not all; with the Bundler and Minification working together, a developer can create smoother and high-performance solutions for the end-users.
Latest posts by Hiren Patel (see all)
- Steps to Bundling And Minification In ASP.NET Core 3.0 - December 2, 2021