2014-07-16 81 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完成,謝謝! –