如何在Meteor.js中手动加载FontAwesome 4 [英] How to manually load FontAwesome 4 in Meteor.js
问题描述
由于它的非传统方式,我总是很难在Meteor.js中手动加载外部库.我需要一些有关如何以最简洁的方式加载这些库的建议
I always find it difficult to manually load external libraries in Meteor.js due to its non-traditional way. I need some advice on how to load these libraries in the cleanest possible way
1 client
2 server
3 packages
4 public
4.1 resources
4.2 font-awesome
4.2.1 css
4.2.2 fonts
4.2.3 less
4.2.4 scss
4.3 fonts
以上是我的根结构.在公用文件夹中,我所有的图像都放在资源下,然后是字体真棒4的文件夹.现在,当我加载它时,它会显示一个方形符号,表示它未正确加载.
Above is my root structure. In the public folder, I have all the images under resources and then the folder for font-awesome 4. Now, when I load this it shows the square symbol meaning it's not loading it properly.
给我的印象是,流星不需要在流星中引用任何CSS等,因为它们在运行时都捆绑在一起了.我想念什么吗?
I was under the impression that there is no need to reference any CSS etc in meteor as it's all bundled together at runtime. Am I missing something?
我确实尝试过使用陨石包,但是它只是安装东西而什么也不做!我宁愿手动进行操作,并在需要的地方更改引用.
I did try using the meteorite packages but it just installs stuff and does nothing! I'd rather do it manually and change the references where needed.
推荐答案
如果您知道我的意思,我经常问自己同样的问题.
您可以修改字体真棒的CSS文件,以便将字体URL引用到/font-wesome/fonts/
而不是../fonts
.将css/less文件(例如font-awesome.css
)移动到/client
You could modify the font awesome css files so that the fonts url is referenced to /font-wesome/fonts/
instead of ../fonts
. Move the css/less files (such as font-awesome.css
) into /client
例如通常
url('../fonts/fontawesome-webfont.woff?v=4.0.3')
将其更改为
url('/font-awesome/fonts/fontawesome-webfont.woff?v=4.0.3')
每种类型的字体也都有其他名称,以上是woff
的字体,没有骨头.
There are also others for each type of font the above is for woff
, no bone.
目录将取决于文件在/public
中的位置,例如,如果使用/public/danielle
,则将使用/danielle
The directory would depend on the location of your file in /public
, e.g if you used /public/danielle
you would use /danielle
如果您添加了陨石,也不要忘记将其也添加到流星中,即
If you added with meteorite don't forget to add it to meteor too i.e
mrt add font-awesome
meteor add font-awesome
或Windows
cd packages
git clone https://github.com/nate-strauser/meteor-font-awesome.git
rename meteor add meteor-font-awesome font-awesome
meteor add font-awesome
这篇关于如何在Meteor.js中手动加载FontAwesome 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!