2014-07-16 54 views
1

我有一个rails应用程序,并管理我的资产,我正在使用凉亭。如果可能的话,我更喜欢不使用像JS和CSS这样的资源。字体很棒字体没有加载?

在我的vender/assets/stylesheets目录中,我有以下内容:font-awesomescssfonts

在我的轨道app/assets/stylesheets/application.scss我有以下几点:

/* 
* This is a manifest file that'll be compiled into application.css, which will include all the files 
* listed below. 
* 
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. 
* 
* You're free to add application-wide styles to this file and they'll appear at the top of the 
* compiled file, but it's generally better to create a new file per style scope. 
* 
*= require_self 
*= require_tree . 
*= require style.scss 
*= require chosen/chosen.min 
*= require jquery.ui.all 
*= require selectize.js/css/selectize.css 
*= require selectize.js/css/selectize.bootstrap3.css 
*= require font-awesome/scss/font-awesome 
*/ 

的页面加载罚款。但是,当我这样做时:<i class="fa-question></i>而不是得到一个问号我得到一个[]。所以,我检查了源标签在Chrome中看到最新加载和font-awesome目录下它只是font-awesome.scss,在观看在那里我看到:

/*! 
* Font Awesome 4.1.0 by @davegandy - http://fontawesome.io - @fontawesome 
* License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) 
*/ 

@import "variables"; 
@import "mixins"; 
@import "path"; 
@import "core"; 
@import "larger"; 
@import "fixed-width"; 
@import "list"; 
@import "bordered-pulled"; 
@import "spinning"; 
@import "rotated-flipped"; 
@import "stacked"; 
@import "icons"; 

所以我自信地说,这是加载CSS ,但字体未被加载。所以,我看着变量,其中的字体路径将定义见:

$fa-font-path:  "../fonts" !default; 

而基于上面列出的目录结构,字体目录确实是一个目录了。

那么,是怎么回事?

回答

2

我遇到过类似的问题,并通过使用以下的css文件固定它:

<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> 

我不记得什么地方出了错,只是希望这会有所帮助。

2

有关记录,实际错误在这里是你没有分配“fa”类。

相反的:

<i class="fa-question"></i> 

您需要:

<i class="fa fa-question"></i> 
+0

请缺失报价添加到类的末尾。 – Timbadu

+0

@Timbadu完成,谢谢! –