-1

我在生产中看不到 icomoon 图标,因为它返回 404 错误:

GET /icons/icomoon.woff net::ERR_ABORTED 404(未找到)

GET /icons/icomoon.woff2 net::ERR_ABORTED 404(未找到)

文件在正确的路径中:公共/图标

我在 public/icons/style.css 中有以下代码:

font-face {
  font-family: 'icomoon';
  src:
    url('icomoon.woff') format('woff'),
    url('icomoon.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

我试图以这种方式放置 src:

  src: url('icomoon.woff') format('woff');
  src: url('icomoon.woff2') format('woff2');

但它没有用。

我还尝试将以下代码放在 public/web.config 中:

<system.webServer>
    <staticContent>
      <clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" />
      <remove fileExtension=".woff" />
      <remove fileExtension=".woff2" />
      <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
      <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
    </staticContent>

而且它也不起作用。

4

1 回答 1

1

已解决,Cloudways 默认禁用 .woff 文件的执行。我所要做的就是打开一张票并要求他们启用它。

于 2020-11-19T17:14:22.453 回答