scss文件中的相对URL路径

时间:2019-09-13 15:30:30

标签: node.js angular typescript angular-cli angular8

我的scss文件中有一些相对的URL路径,例如:

&.id-1 {
    background-image: url("./assets/images/live-sports/icon-soccer.svg");
}

,对于其他元素,我有这个网址路径

&.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会忽略子文件夹,并将所有资源文件放在resources文件夹中,并且“ icon-soccer.svg”会相互覆盖。我该如何解决?

angular-cli版本:8.1.3

1 个答案:

答案 0 :(得分:0)

您的网址不正确,您应将其删除

"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"
        ]
      }