Clouda-team / Cloudajs

Clouda Framework - A Realtime Javascript RIA Framework For Mobile WebApp
899 stars 403 forks source link

如何加载font-awesome等第三方图标库 #95

Open pockry opened 10 years ago

pockry commented 10 years ago

我将css和fonts文件夹都放在app/assets下,然后通过package.js引入,则css中的fonts相对地址出错。 通过修改debug.html和index.html引入css的话,图标不能正常显示,firefox和chrome已测试。 但是,通过使用font-awesome的第三方cdn来引入css的话,图标能够正常显示。

目前怀疑是因为router没有设置fonts文件(.woff/.ttf),因此浏览器端无法正常识别这些文件。 firefox的控制台的错误信息如下:

downloadable font: incorrect file size in WOFF header (font-family: "Icons" style:normal weight:normal stretch:normal src index:2) source: http://localhost:8080/assets/fonts/icons.woff semantic.min.css downloadable font: rejected by sanitizer (font-family: "Icons" style:normal weight:normal stretch:normal src index:2) source: http://localhost:8080/assets/fonts/icons.woff semantic.min.css

downloadable font: incorrect entrySelector for table directory (font-family: "Icons" style:normal weight:normal stretch:normal src index:3) source: http://localhost:8080/assets/fonts/icons.ttf semantic.min.css downloadable font: rejected by sanitizer (font-family: "Icons" style:normal weight:normal stretch:normal src index:3) source: http://localhost:8080/assets/fonts/icons.ttf semantic.min.css downloadable font: no supported format found (font-family: "Icons" style:normal weight:normal stretch:normal src index:4) source: (end of source list)