June 29, 2016 by Anuraj
ASP.NET Core Bundling Minification
The file is self explantory, you can specify multiple file in the inputFiles element, which will be combined and minified based on the minify element. Now you can combine and minify using “dotnet bundle” command. Here is the output when I run the dotnet bundle command on my MVC project.
You can integrate it to the development lifecycle by adding the dotnet build command in the “precompile” script section in project.json file. If you are using Yo ASP.NET generator, the project template will be using precompile script section in project.json.
There are few more commands also available with dotnet bundle tool.
- dotnet bundle clean - Executing dotnet bundle clean will delete all output files from disk.
- dotnet bundle watch - To automatically run the bundler when input files change, call dotnet bundle watch. This will monitor any file changes to input files in the working directory and execute the bundler automatically.
- dotnet bundle help - Get help on how to use the CLI.
If you are using Visual Studio, you can get more information about Bundling and Minification here
Happy Programming :)
Copyright © 2024 Anuraj. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Powered by Jekyll. Hosted with ❤ by GitHub