[英]How to fix the issue with the referencing static files in ASP.NET core
[英]Asp.Net Core 2.1 Static Files
通常我们将css
与like链接在一起
<environment include="Development">
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="~/css/site.css" />
<link rel="stylesheet" href="~/css/IndexCss.css" />
</environment>
但是我可以链接文件夹吗? Cus需要链接的CSS过多...或任何建议
ASP.NET Core MVC
带有内置的捆绑程序和压缩程序,因此许多CSS
文件可以成为一个文件,并且对JavaScript
文件也是如此。
只需在项目的根目录创建一个名为bundleconfig.json
的文件,其内容如下:
[
{
"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
}
]
此处的更多信息: https : //docs.microsoft.com/zh-cn/aspnet/core/client-side/bundling-and-minification?view=aspnetcore-2.2&tabs=visual-studio
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.