2014-01-15 52 views
4

我一直在嘗試使用http://startbootstrap.com/stylish-portfolio和所有文件和拷貝下載到該目錄後,我得到的部分_bordered拉以下錯誤:資產管道未定義的變量SASS

ActionView::Template::Error (Undefined variable: "$fa-css-prefix". 

然而變量被定義,我正在導入(或至少嘗試)部分。

我的資產/樣式表目錄如下:

--application.css.scss 
--bootstrap.css.scss 
--font-awesome.css.scss.erb 
--stylish-portfolio.css.scss 
--|font-awesome 
    --_bordered-pulled.css.scss 
    --...(other partials) 
    --font-awesome.css.scss 

Application.css.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 . 
*/ 

@import 'font-awesome/font-awesome'; 
@import 'bootstrap'; 
@import 'font-awesome'; 
@import 'stylish-portfolio'; 

字體,awesome.css.scss

/*! 
* Font Awesome 4.0.3 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"; 

_bordered拉住.css.scss

// Bordered & Pulled 
// ------------------------- 

.#{$fa-css-prefix}-border { 
    padding: .2em .25em .15em; 
    border: solid .08em $fa-border-color; 
    border-radius: .1em; 
} 

.pull-right { float: right; } 
.pull-left { float: left; } 

.#{$fa-css-prefix} { 
    &.pull-left { margin-right: .3em; } 
    &.pull-right { margin-left: .3em; } 
} 

它是語法錯誤還是我設置我的資產管道錯誤?

_variable.css.scss https://github.com/IronSummitMedia/startbootstrap/blob/master/templates/stylish-portfolio/font-awesome/scss/_variables.scss

+0

你能告訴我們'variables.css.scss'嗎?我猜這就是你定義變量的地方? – lime

+0

剛剛更新了問題 –

+0

很奇怪。你確定沒有分號嗎? ;)我會通過直接在'_bordered-pulling.css.scss'中設置'$ fa-css-prefix'來進一步調試它,看看它是否工作,然後嘗試'_variables.css.scss'中的其他變量來縮小範圍如果其中任何一個在範圍內。對不起,我忍不住了。 – lime

回答

5

你必須做到以下幾點:

打開項目的字體真棒/更少/ variables.less或字體真棒/ SCSS/_variables.scss並編輯@ fa-font-path或$ fa-font-path變量指向你的字體目錄。

來源:fontawsome的文檔

http://fontawesome.io/get-started#custom-less

+0

無法解決這個問題,可以你請檢查一下。 http:// stackoverflow。com/questions/30885509/bundle-exec-rake-assetsprecompile-throws-font-awesome-related-issue – Suraj

1

請檢查您是如何預編譯的資產。檢查初始化/ assets.rb(也可能是環境/ production.rb你),以確保您的預編譯的資產以友好的方式,像這樣:

config.assets.precompile += ["*.js", "*.scss", "*.jpg", "*.png"] 

我有同樣的錯誤時,它是

config.assets.precompile += [/.*\.png/,/.*\.ico/,/.*\.jpg/,/.*\.js/,/.*\.scss/] 
+0

我認爲我們不需要在開發環境中預編譯資產env – Jaswinder