2012-12-04 157 views
27

我正在使用bootstrap處理我的第一個項目,每次嘗試查看我的項目時都會出現此錯誤。我環顧四周,無法找到有同樣問題的人。任何幫助將是偉大的!提前致謝。變量@fontAwesomeEotPath_iefix未定義


少:: ParseError在搜索#指數

Showing /Users/Basil/Dropbox/College/CS 50/playedby.me/app/views/layouts/application.html.erb where line #4 raised: 

variable @fontAwesomeEotPath_iefix is undefined 
    (in /Users/Basil/Dropbox/College/CS 50/playedby.me/app/assets/stylesheets/bootstrap_and_overrides.css.less) 
Extracted source (around line #4): 

1: <!DOCTYPE html> 
2: <html> 
3: <head> 
4: <%= stylesheet_link_tag 'application.css', :media => "all" %> 
5: <%= javascript_include_tag "application" %> 
6: <%= csrf_meta_tags %> 
7: </head> 

這裏是我的bootrstrap_and_overrides.css.less

@import "twitter/bootstrap/bootstrap"; 
body { 
padding-top: 60px; 
} 

@import "twitter/bootstrap/responsive"; 

// Set the correct sprite paths 
@iconSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings.png'); 
@iconWhiteSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings-white.png'); 

// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines) 
// Note: If you use asset_path() here, your compiled boostrap_and_overrides.css will not 
//  have the proper paths. So for now we use the absolute path. 
@fontAwesomeEotPath: '/assets/fontawesome-webfont.eot'; 
@fontAwesomeWoffPath: '/assets/fontawesome-webfont.woff'; 
@fontAwesomeTtfPath: '/assets/fontawesome-webfont.ttf'; 
@fontAwesomeSvgPath: '/assets/fontawesome-webfont.svg'; 

// Font Awesome 
@import "fontawesome"; 

// Your custom LESS stylesheets goes here 
// 
// Since bootstrap was imported above you have access to its mixins which 
// you may use and inherit here 
// 
// If you'd like to override bootstrap's own variables, you can do so here as well 
// See http://twitter.github.com/bootstrap/less.html for their names and documentation 
// 
// Example: 
// @linkColor: #ff0000; 

@successBackground: white; 
@successText: @green; 
@errorBackground: white; 
@errorText: @red; 

@navbarHeight: 60px; 

.alert-success, .alert-error { 
    border: 10px solid @green; 
    padding: 2%; 
    font-size: 125%; 
    line-height: 150%; 
} 

.alert-success { 
    border-color: @green; 
} 

.alert-error { 
    border-color: @red; 
} 
+0

請注意'@fontAwesomeEotPath是undefined'的確是這個問題 –

+0

可能是你剛剛救了我的下午http://stackoverflow.com/questions/13701132/ – freemanoid

回答

66

請注意,您的bootstrap_and_overrides.css .less沒有var可錯誤的是抱怨。

添加下面的行與其他@fontAwesome變量,你應該很好。

@fontAwesomeEotPath_iefix: asset-path("fontawesome-webfont.eot#iefix"); 

或者通過運行rails g bootstrap:install -f更新您的twitter引導安裝。

+5

的副本。 – Max

+0

我不清楚,我不得不在升級時重新運行發生器。 TY –

+0

你爲我節省了很多時間。謝謝! – ExiRe

3

也許你忘了安裝bootstrap,你可以嘗試下面的命令。

rails g bootstrap:install 
20

這也發生在我身上。當你更新Bootstrap gem時,你必須更新它的javascript和css。要做到這一點,運行這個命令:

rails g bootstrap:install -f 

這將一行添加到您的應用程序/資產/ CSS/bootstrap_overrides.css.less文件,它看起來像:

@fontAwesomeEotPath_iefix: asset-path("fontawesome-webfont.eot#iefix"); 

這將解決這一問題。

+4

請注意,這將刪除'app/assets/css/bootstrap_overrides.css.less'中的所有自定義更改。 –

+0

@SvenKoschnicke:多數民衆贊成在正確。但通常我們不使用此文件來添加我們的自定義方法。無論如何,謝謝指出。 – Jyothu