【发布时间】:2015-04-08 18:10:59
【问题描述】:
我试图在我的 Rails 4 应用程序的 application.css 中要求“font-awesome.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 any plugin's vendor/assets/stylesheets directory 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 bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require 'font-awesome.scss'
*= require_tree .
*= require_self
*/
'font-awesome.scss' 导入一堆看起来像部分的文件,前面有一个下划线。这些部分之一 (_variables.scss) 定义了一个变量,我在收到以下错误消息时需要定义该变量:
Sass::SyntaxError (Undefined variable: "$fa-css-prefix".
(in /Users/bla/rails_projects/Homepage/app/assets/stylesheets/_bordered-pulled.scss:4)):
app/assets/stylesheets/_bordered-pulled.scss:4
app/views/layouts/application.html.erb:35:in `_app_views_layouts_application_html_erb__3531690645719711557_70221015865520'
我做错了什么?
【问题讨论】:
-
你有没有试过在 tree 和 self 之后要求 font-awesome? . Bootstrap 类似于基础,我的基础文件总是需要在 tree 和 self 之后才能正确导入到资产管道中。另外,如果需要,您会希望自己的 CSS 覆盖 font-awesome。
标签: css ruby-on-rails twitter-bootstrap