Saturday, September 22, 2018

.Net Core | Bundling & Minification

Bundling is a process to combine same type of multiple reference files into single file to minimize multiple files loading into one.
Minification is a process in which some techniques get applied over file like removing whitespace, shortening variable names, replacing verbose functions with shorter and more concise functions etc.

  • Add a json file bundleconfig.json.
    • OutputFileName: File that will be created after bundling and minification of given input files.
    • inputFiles: One or more files to be bundled and minified into one output file.




  • If not using Visual studio dotnet bundle is the command that can be used on command line to perform bundling.
  • Using Visual studio  
  1. Install BundlerMinifier.Core from https://marketplace.visualstudio.com/items?itemName=MadsKristensen.BundlerMinifier
  2. Use Task Runner Explorer  
    Bottom part of above given picture is showing Task Runner Explorer.
  3. All files or output files can be configured for Bundling and Minification on below events, bundleconfig.json.bindings file contains this information. On these events output files get created
    • Before Build
    • After Build 
    • Clean Build
    • Project Open

Note: Gulp and Grunt are java script based tools that can be used for bundling and minification easily.

No comments:

Post a Comment

CI/CD - Safe DB Changes/Migrations

Safe DB Migrations means updating your database schema without breaking the running application and without downtime . In real systems (A...