Reputation: 973
Do we have any way to implement Bundling and Minification without using any tools like Grunt, Gulp, WebOptimizer etc. in ASP.NET MVC Core 2.2 web application similar to ASP.NET MVC?
Upvotes: 1
Views: 772
Reputation: 20116
ASP.NET supports bundling and minification out of the box, but same is not true for ASP.NET Core.
If you intend for css and javascript files, ASP.NET Core comes with a built in BundlerMinifier
.In ASP.NET Core 2.1 or later, add a new JSON file, named bundleconfig.json
, to the MVC or Razor Pages project root like this
[
{
"outputFileName": "wwwroot/css/site.min.css",
"inputFiles": [
"~/lib/bootstrap/dist/css/bootstrap.css",
"~/css/*.css"
]
},
{
"outputFileName": "wwwroot/js/site.min.js",
"inputFiles": [
"~/js/*.js"
],
"minify": {
"enabled": true,
"renameLocals": true
},
"sourceMap": false
}
]
Refer to Bundle and minify static assets in ASP.NET Core
Upvotes: 2