English 中文(简体)
• 不同根基地点时如何使用单体解决办法中的资产
原标题:How to access the assets folder in angular solution when having different root locations
  • 时间:2019-10-17 12:53:01
  •  标签:
  • css
  • angular

我在资产/资产夹中有一只手文件,需要查阅资产/工具夹中的一些字体。 我可以通过书写字典(url)(/assets/fonts/myfont.svg)在当地工作。

在服务器上,由于通往我网站根基的道路是我的主人。 我已将基数从现在改为现在。

然后我尝试:

  • url( assets/fonts/myfont.svg )
  • url( ~assets/fonts/myfont.svg )
  • url( ./assets/fonts/myfont.svg )

但是,当时的解决办法获得了汇编(能够解决资产/公证/公证问题)。

非常感谢!

问题回答

Can you try this url ~src/assets/fonts/myfont.svg It definitely works for me.

您必须申报您的<代码>angular.json中的所有资产,例如通常在违约情况下申报的资产夹。 这使得你的资产能够直接获得,在建筑过程之后,你会注意到资产被转移在碎块中。 然后使用你将写成<代码>/assets/img.png/code>的资产。 前面的斜体表示,从根底中提取名录的链接,而assets/img.png有时可以从目前的目录中解释。

页: 1

"assets": [
              "src/favicon.ico",
              "src/assets"
            ],

以及此类项目中的根源:

"sourceRoot": "src",

1 I m in src/app/modules/model/test/test.component.ts, 如果我想进口src/assets.

页: 1

../../../../assets ;,

页: 1

<img class="frame" src="assets/img/default.png">

页: 1

@font-face {
  src: url( ../../../../assets/fonts/myfont.svg );
}

您需要回到前面的栏目

src
├── app ../
│   └── modules ../
│      └── model ../
│         └── test ../
├── assets
│   └── fonts




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

Drop down background url in Safari Issue

selectBox.selectCSS { background: url(/Images/replacementSelectBackground.png) top left no-repeat height:auto; } I have an issue in Safari only where the image is not rendering on top ...

CSS specific for Safari

How do you target specifically safari in css with styles?

Aligning textarea in a form

Ive used the following css code to align my form elements: form { position:relative; } form input { position:absolute; left:11em; } However, the textarea element is not aligned correctly with the ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

CSS problem with page footer

I have defined my page footer in the css file as: #footer { position: absolute; height: 50px; text-align: center; background: #66CCCC; bottom: 0px; left: 0px; width: 100%; height: ...