简体   繁体   English

Angular Monorepo 与 Basehref 共享资产

[英]Angular Monorepo shared assets with Basehref

I'm working on a new project and set up a new nx angular Monorepo.我正在开发一个新项目并设置一个新的 nx angular Monorepo。 I added a lib with general styles and also global assets.我添加了一个带有通用样式和全局资产的库。 I followed this article: https://medium.com/@nit3watch/angular-shared-assets-with-multiple-apps-nrwl-nx-b4801c05c771 Everything is working in dev mode, just in prod mode i can't get the image inside scss with url().我关注了这篇文章: https : //medium.com/@nit3watch/angular-shared-assets-with-multiple-apps-nrwl-nx-b4801c05c771一切都在开发模式下工作,只是在生产模式下我无法获得带有 url() 的 scss 中的图像。 The problem is that i set baseHref inside angular.json and this baseHref is missing inside the image url.问题是我在 angular.json 中设置了 baseHref,而图像 url 中缺少这个 baseHref。 Does any one knows how to fix this?有谁知道如何解决这个问题?

I have added the asstes this way to the Project:我以这种方式将 asstes 添加到项目中:

  {
            "glob": "**/*",
            "input": "./libs/styles-lib/src/lib/",
            "output": "/global-assets/"
          }

Inside scss: background-image: url("/global-assets/img/bg_btn.png");在 scss: background-image: url("/global-assets/img/bg_btn.png");

它就是这样工作的: url("^global-assets/img/bg_btn.png");

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

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