修改 bundleconfig.json 对 js 进行 bundle&minify
// js
{
"outputFileName": "wwwroot/js/all.min.js",
"inputFiles": [
"node_modules/jquery-slim/dist/jquery.slim.js",
"node_modules/popper.js/dist/js/popper.js",
"node_modules/bootstrap/dist/js/bootstrap.js",
"wwwroot/js/site.js"
],
"minify": {
"enabled": true,
"renameLocals": true
},
"sourceMap": false
},
{
"outputFileName": "wwwroot/js/vendor.js",
"inputFiles": [
"node_modules/jquery-slim/dist/jquery.slim.js",
"node_modules/popper.js/dist/js/popper.js",
"node_modules/bootstrap/dist/js/bootstrap.js"
],
"minify": {
"enabled": false
}
}
设置 MVC 和中间件
- 注册 MVC 服务到 IoC 容器
- 在 ASP.NET Core 管道里使用并配置 MVC 中间件
注册 MVC 服务仅需在 Startup 的 ConfigureServices 方法顶部加一句 services.AddMvc(); 即可。
通过下面的代码在 Configure 方法里面使用和配置 MVC 和中间件:
public void Confi

本文是ASP.NET Core MVC入门教程的一部分,主要讲解如何配置MVC和中间件。内容包括修改bundleconfig.json以实现js的bundle&minify,将MVC服务注册到IoC容器,以及在ASP.NET Core管道中使用和配置MVC中间件。
最低0.47元/天 解锁文章
2517

被折叠的 条评论
为什么被折叠?



