trouble with font-face in meteor based on Discover Meteor microscope app

余生长醉 提交于 2019-12-24 09:00:03

问题


I've gone through the Discover Meteor book and successfully created Microscope. Now I'm trying to build my own app based on what I've learned. I want to use @font-face for fonts and icon fonts. I can't get them to show up.

Here's my directory structure: client/stylesheets

I've got my fonts in the stylesheets folder. I'm using scss, by the way, and that's working fine with the scss package. Here's how I'm calling the fonts in the stylesheet:

@font-face {
  font-family: 'AmaranthItalic';
  src: url('Amaranth-Italic-webfont.eot');
  src: url('Amaranth-Italic-webfont.eot?#iefix') format('embedded-opentype'),
  url('Amaranth-Italic-webfont.woff') format('woff'),
  url('Amaranth-Italic-webfont.ttf') format('truetype'),
  url('Amaranth-Italic-webfont.svg#AmaranthItalic') format('svg');
  font-weight: normal;
  font-style: normal;
}

I've tried '/stylesheets/Amaranth etc. and all other combinations that I can think of and nothing is working. I've tried putting them in public. Nothing.

I know files like this are supposed to go in public folder but that seems to kill the stylesheets entirely. I'm not sure why the Microscope directory design would cause that to happen.

These question/answers didn't help: using font-face in meteor? Icon font from fontello not working with Meteor js

Thanks for any help.


回答1:


Put the fonts in /public

Anything put here won't be translated by meteor into anything else. /public is the root of your site, so if you need to reference anything in /public then you don't need to do /public/whatever/blah its just /whatever/blah.

Also /public lives in the root of your app, not under /client or /server but at the root level along with /client and /server.



来源:https://stackoverflow.com/questions/24049392/trouble-with-font-face-in-meteor-based-on-discover-meteor-microscope-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!