简体   繁体   English

scss url() 相对于导入的 scss 文件解析

[英]Scss url() resolves relative to imported scss files

We are currently implementing prime ng into our application.我们目前正在将 Prime ng 实施到我们的应用程序中。 I have referenced the scss files under the style tag in the angular.json.我已经在 angular.json 中的 style 标签下引用了 scss 文件。 I ve looked into the referenced scss and it also contains multiple scss imports.我查看了引用的 scss,它还包含多个 scss 导入。 Like @import _layout.scss from different folders.就像来自不同文件夹的@import _layout.scss一样。 The Problem is that the used assets in these imported scss files url("../images/special/#{$horizontalMenuBgImageLight}") are resolved relative to the file they are in instead of relative to the main scss i referenced in the angular.json under the style tag.问题是这些导入的 scss 文件url("../images/special/#{$horizontalMenuBgImageLight}")中使用的资产是相对于它们所在的文件而不是相对于我在 angular 中引用的主 scss 解析的.json 在样式标签下。 So i get a "can't resolve" error for these assets.所以我收到这些资产的“无法解决”错误。 I could just move the folders to the needed location, but i am wondering if this is the correct solution since the folder structure is setup by prime ng like this.我可以将文件夹移动到所需的位置,但我想知道这是否是正确的解决方案,因为文件夹结构是由这样的 Prime ng 设置的。

I found out that since Angular 10 that my described behavior is the default.我发现自 Angular 10 以来,我描述的行为是默认行为。 For more context: https://github.com/angular/angular-cli/pull/17537更多上下文: https://github.com/angular/angular-cli/pull/17537

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM