These will be bundled and minified into two files, and, respectively. In my example, I have two css files, main.css and custom.css, and two js files, util.js and main.js. Create a bundleconfig.json file at the root of the Web project. $ cat Web.csprojĪ JSON file, called bundleconfig.json, contains the information about what files to bundle and minify. The version number may be different depending on when you add the package. If you take a peek in your Web.csproj file, you will see the package reference to BuildBundlerMinifier. $ dotnet add package BuildBundlerMinifier $ cd Webįrom within the Web project directory, add the BuildBundlerMinifier Package. Just to make sure all is well, let's build the web project. ![]() ![]() Project 'Web/Web.csproj' added to the solution. The template "ASP.NET Core Empty" was created successfully. The template "Solution File" was created successfully. ![]() NET Core CLI, let's create a solution and an empty ASP.NET Core Web Project and add the web project to the solution. We don't need to add any code, but we do need to create an ASP.NET Core Web Project to understand bundling and minification. If you're new to bundling and minification, here is a quick tutorial. NET Core CLI by adding the BundlerMinifier.Core package, you can use the dotnet bundle command to clean, bundle, and watch files from the command line ad hoc. The BuildBundlerMinifier Package handles the bundling and minification at build time. I love how transparent and easy it is to bundle and minify CSS and JS in an ASP.NET Core Web Application.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |