首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法为WOFF,WOFF2 & TTF解码下载的字体

无法为WOFF,WOFF2 & TTF解码下载的字体
EN

Stack Overflow用户
提问于 2020-11-16 21:53:01
回答 2查看 889关注 0票数 0

https://celbux-frontend-ng.ew.r.appspot.com/

只有在部署到App Engine之后,我才能让我的Angular前端与tim-icons / fa-icons一起工作时遇到麻烦。我得到以下错误:

代码语言:javascript
复制
Failed to decode downloaded font: https://celbux-frontend-ng.ew.r.appspot.com/nucleo.5987dd12fea78ce5f97a.woff2
home:1 OTS parsing error: invalid version tag

home:1 Failed to decode downloaded font: https://celbux-frontend-ng.ew.r.appspot.com/nucleo.f0b489a5dbbff08833d2.woff
home:1 OTS parsing error: invalid version tag

home:1 Failed to decode downloaded font: https://celbux-frontend.ng.ew.r.appspot.com/nucleo.b17a118e13e53558658b.ttf
home:1 OTS parsing error: invalid version tag

当我在http://localhost:4200上本地运行该程序时,字体可以正常工作。这些错误仅在我访问已部署的网站时出现。

我很确定这是由于app.yaml处理路由的方式造成的,我对此很不满意。这是我目前的app.yaml。

代码语言:javascript
复制
runtime: python27
api_version: 1
threadsafe: true
handlers:

  # Initial route that will serve up index.html, main entry point to your app
  - url: /
    secure: always
    static_files: celbux-frontend-ng/index.html
    upload: celbux-frontend-ng/.*

  # Routing for typedoc, assets and favicon.ico to serve directly
  - url: /((?:assets|docs)/.*|favicon\.ico)
    secure: always
    redirect_http_response_code: 301
    static_files: celbux-frontend-ng/\1
    upload: celbux-frontend-ng/.*

  # Routing for any js files
  - url: /(.*\.js)
    secure: always
    redirect_http_response_code: 301
    static_files: celbux-frontend-ng/\1
    upload: celbux-frontend-ng/.*\.js

  # Routing for any css files
  - url: /(.*\.css)
    secure: always
    redirect_http_response_code: 301
    static_files: celbux-frontend-ng/\1
    mime_type: text/css
    upload: celbux-frontend-ng/.*\.css

  # Routing for anything (wild card) after
  - url: /.*
    secure: always
    static_files: celbux-frontend-ng/index.html
    upload: celbux-frontend-ng/.*

所以问题是,当我的路由被部署时,我如何让它在这里工作,这样我就不会得到OTS解析错误&字体解码错误。

谢谢!

EN

回答 2

Stack Overflow用户

发布于 2020-11-16 22:34:29

在您的app.yaml中尝试如下所示:

代码语言:javascript
复制
runtime: nodejs12
handlers:
  - url: /
    static_files: dist/index.html
    upload: dist/index.html
  - url: /(.*)
    static_files: dist/\1
    upload: dist/.*

app.yaml必须位于项目的根目录下

票数 1
EN

Stack Overflow用户

发布于 2020-11-17 02:05:28

感谢@Methkal Khalawi把我引向了正确的方向。我对他的解决方案的问题是,所有的角度路由都会中断。这个新的app.yaml配置非常适合我。

工作webapp:https://celbux-frontend-ng.ew.r.appspot.com/

代码语言:javascript
复制
runtime: nodejs12

handlers:
  - url: /
    secure: always
    static_files: celbux-frontend-ng/index.html
    upload: celbux-frontend-ng/index.html

  #  Routing rules for resources, css, js, images etc. Any file with format filename.ext
  - url: /(.*\.(.+))$
    secure: always
    static_files: celbux-frontend-ng/\1
    upload: celbux-frontend-ng/(.*\.(.+))$

  #  Routing rule for Angular Routing
  - url: /(.*)
    secure: always
    static_files: celbux-frontend-ng/index.html
    upload: celbux-frontend-ng/index.html
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64859333

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档