【问题标题】:variable @fontAwesomeEotPath_iefix is undefined变量@fontAwesomeEotPath_iefix 未定义
【发布时间】:2013-06-12 14:53:16
【问题描述】:

我正在使用引导程序处理我的第一个项目,但每当我尝试查看我的项目时都会收到此错误。我环顾四周,找不到有同样问题的人。任何帮助都会很棒!提前致谢。


搜索中的Less::ParseError#index

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;
}

【问题讨论】:

标签: twitter-bootstrap less


【解决方案1】:

请注意,您的 bootstrap_and_overrides.css.less 没有错误所抱怨的变量。

将以下行与其他 @fontAwesome 变量一起添加,您应该会很好。

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

或者通过运行 rails g bootstrap:install -f 来更新您的 twitter 引导安装。

【讨论】:

  • 你刚刚拯救了我的下午。
  • 我不清楚是否必须在升级时重新运行生成器。 TY
  • 你为我节省了很多时间。谢谢!
【解决方案2】:

这也发生在我身上。当您更新 Bootstrap gem 时,您必须更新其 javascript 和 css。为此,请运行:

rails g bootstrap:install -f

这将在您的 app/assets/css/bootstrap_overrides.css.less 文件中添加一行,如下所示:

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

这将解决问题。

【讨论】:

  • 请注意,这将删除app/assets/css/bootstrap_overrides.css.less中的所有自定义更改
  • @SvenKoschnicke:没错。但是通常我们不会使用这个文件来添加我们的自定义方法。无论如何感谢您指出这一点。
【解决方案3】:

可能你忘记安装 bootstrap,你可以试试下面的命令。

rails g bootstrap:install

【讨论】:

    猜你喜欢
    • 2012-11-21
    • 2011-06-11
    • 2021-02-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-16
    相关资源
    最近更新 更多