angular - 如何在同一目录中的文件中指定路径?
问题描述
我<base href="/" />
在 index.html 文件的顶部。
下面我尝试将加载文件放在同一个目录下:
<link rel="stylesheet" href="styles.43ad38c1c1e1ce781d48.css">
结构目录为:
/site/
/site/index.html
/site/styles.43ad38c1c1e1ce781d48.css
解决方案
您可以通过 angular.json 中项目的构建目标选项中的样式选项添加更多全局样式。这些将完全加载,就像您将它们添加到 index.html 内的标记中一样。
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"styles": [
"src/styles.css",
"src/more-styles.css",
],
参考:https ://github.com/angular/angular-cli/wiki/stories-global-styles
推荐阅读
- python - DatabaseError: 对 sql 对象执行失败': 要执行的第一个参数必须是字符串或 unicode 查询
- r - 使用 data.table 滚动窗口和自联接
- django - 如何使用带有外键的 django api
- http - 如何查看网页在哪个版本的http上运行?
- javascript - 当 api 需要时间(或仍在处理中)时,Angularjs $http.post 得到“net::ERR_EMPTY_RESPONSE”响应
- git - Return the Number of the Last Merged Pull Request Git
- sql - 如何将带有输入参数的microsoft access查询导入excel
- javascript - 获取 webpack 包中包含的主要库/模块的版本
- powershell - PowerShell gc 缺少括号
- php - LARAVEL:如何使用 SOLID 原则的开闭原则?