1

我按照这篇文章的工作流程指示进行操作,但出现以下错误:

Undefined variable: "$zindex-navbar".
(in /Users/thalatta/code/aviary-hours/app/assets/stylesheets/_navbar.scss)

这是堆栈跟踪:

app/assets/stylesheets/_navbar.scss:13
app/views/layouts/application.html.erb:7:in    `_app_views_layouts_application_html_erb___2018644895263320512_70131537402780'
app/controllers/application_controller.rb:25:in `block in <class:ApplicationController>'

现在这个变量$zindex-navbar肯定是我的_variables.scss部分。这是文件中的内容:

$zindex-navbar:            1000 !default;

这是在我的app/assets/stylesheets目录中,并且@imported在我的bootstrap.scss文件中的以下行中:

@import "variables";

其中,bootstrap它本身是由我的application.css.scss文件在这里导入的:

@import "bootstrap";

现在我担心的是它没有正确加载我的所有依赖项,我不确定这是怎么发生的。

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 "bootstrap";

application.css.scss是扩展的问题,.scss因此没有在堆栈跟踪中调用application.html.erb?如何正确设置我的资产以加载 twitter-bootstrap 具有的内置依赖项(即@import <partialname>引导代码中的所有行)

非常感谢你的帮助。

永远属于你,

迈克尔。

4

0 回答 0