当我们发布一个应用程序时,wwwroot 文件夹中的所有文件都会被复制。然后,如果你需要在 index.html 中加载一个 .css,或者一个 dbs,或者一个图像或者.. 你必须
但在 Angular 中,最好的方法是拥有一个 unique.css。这个 css 是你的组件中 css 的联合+全局定义的 css。
在 angular-cli 中,我们使用 angular-cli.json 文件来全局添加 .css(在样式中)
"styles": [
"app/css/bootstrap.css",
"../node_modules/font-awesome/css/font-awesome.css",
"styles.css"
],
在 .net Core 中,我们使用 webpack.config.vendor 全局添加 .css(在 nonTreeShakableModules 中)
const nonTreeShakableModules = [
'bootstrap-css-only/css/bootstrap.css',
'font-awesome/css/font-awesome.css',
'es6-promise',
'es6-shim',
'event-source-polyfill'
];
此外,在 .net Core 中我们也可以使用 vendor.css