I have found plenty of articles that pointed out to me that BundleConfig.cs is no longer a thing with MVC. Instead I am suppose to use third party tools to achieve this. At least, this is my understanding. I have spent a lot of time researching and trying to understand, but can't find anywhere any clear instructions on how to achieve this with bundlingconfig.json
. Some of the articles by microsoft, such as this one https://docs.microsoft.com/en-us/aspnet/core/client-side/bundling-and-minification?view=aspnetcore-2.1&tabs=visual-studio%2Caspnetcore2x talk about how the default template uses it, but it doesn't tell me how exactly they achieve it. Also, when I tried to create a new template with core 2.1 project, it wasn't there. So I'm quite confused as to how to get my bundleconfig.json to work.
Now, I'm a fan of starting from scratch and building things up so I get a good understanding of how they work so I can fix them if things go wrong in future. As such, I created a brand new project with nothing in it and added my controllers, views, everything I need to get a basic website. However, simply just by adding the config file on its own, it does nothing. I was hoping it was part of the mvc framework and it would pick it up and know what to do with it. But I guess that is not the case and I can't find anywhere instructions on what I need to add in addition to the config file for this to work.
Could anyone point me in the right direction?
[
{
"outputFileName": "wwwroot/css/Test.css",
"inputFiles": [
"wwwroot/css/Global.css"
],
"minify": {
"enabled": true,
"renameLocals": true
}
}
]
and then in my cshtml page I added
<link rel="stylesheet" href="~/css/Test.css" />
Bundling is when companies package several of their products or services together as a single combined unit, often for a lower price than they would charge customers to buy each item separately.
Bundling enables you to sell more and decrease marketing and distribution costs. Instead of marketing every product you can group complementary products together and market them as a single product. By packaging different items together you only need one warehouse bin to store them instead of different bins.
Bundling group is a very small minority. In the Amish practices that sanction bed courtship, the boy asks the girl if amish can take her home. If she consents, they drive to her home. They immediately go upstairs and get into her bed fully clothed, where they are expected to talk all night without touching.
The bundling bag, a readily available, makeshift chastity device, was normally tied around the lower half of the girl's body, though some accounts claim that each young person was placed into a bundling bag up to their necks, if possible.
From the section Build-time execution of bundling and minification in your link:
The BuildBundlerMinifier NuGet package enables the execution of bundling and minification at build time. The package injects MSBuild Targets which run at build and clean time. The bundleconfig.json file is analyzed by the build process to produce the output files based on the defined configuration.
All you need to do then is to add package to main project
<PackageReference Include="BuildBundlerMinifier" Version="2.8.391" />
Or if you want to bundle and minify from console, add following nuget:
<DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.8.391" />
and in console from project directory dotnet bundle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With