我的 scss 文件中有一些相对 url 路径,例如:
&.id-1 {
background-image: url("./assets/images/live-sports/icon-soccer.svg");
}
对于另一个元素,我有这个 url 路径
&.id-1 {
-webkit-mask-image: url("./assets/images/live-sports/terminal/icon-soccer.svg");
}
在我的 angular.json 中,该项目的构建选项如下所示:
"options": {
"outputPath": "dist/AppLiveConference",
"resourcesOutputPath": "resources",
"index": "projects/AppLiveConference/src/index.html",
"main": "projects/AppLiveConference/src/main.ts",
"polyfills": "projects/AppLiveConference/src/polyfills.ts",
"tsConfig": "projects/AppLiveConference/tsconfig.app.json",
"aot": false,
"assets": [
"projects/AppLiveConference/src/favicon.ico",
"projects/AppLiveConference/src/assets"
],
"styles": [
"projects/AppLiveConference/src/styles.scss"
],
"scripts": [
"node_modules/jquery/dist/jquery.min.js"
]
}
问题是 angular-cli 会忽略子文件夹并将所有资源文件放在资源文件夹中,并且“icon-soccer.svg”会相互覆盖。我该如何解决这个问题?
angular-cli 版本:8.1.3
最佳答案
你的网址是错误的,你应该删除它
"options": {
"outputPath": "dist/AppLiveConference",
"resourcesOutputPath": "resources",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": false,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": [
"node_modules/jquery/dist/jquery.min.js"
]
}
关于node.js - scss 文件中的相对 url 路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57926478/