gpt4 book ai didi

ruby-on-rails-3 - 如何在 Rails 中传递 Bootstrap 变量

转载 作者:行者123 更新时间:2023-12-04 05:24:09 26 4
gpt4 key购买 nike

我尝试将 Bootstrap 变量传递给 Rails 中的其他文件 - 但失败了。

我的 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 own Vars */
@import 'myvars';

/* Import Twitter Bootstrap */
@import 'bootstrap';

/* Import own layout */
@import 'custom';

当我创建一个 $testVar: 100px;_myvars.scss并尝试在 custom.css.scss 中使用它它不起作用 - 页面无法加载,我收到 Undefined variable: "$testVar". -错误

直接在 custom.css.scss 中定义变量时有效但我宁愿有一个包含所有变量的概述文件(就像我以前将 TB 作为独立使用时那样)。我对 Rails 很陌生,所以请耐心等待:)

提前致谢!

最佳答案

您必须删除 *= require_tree . .检查这个 screen cast了解更多信息。

关于ruby-on-rails-3 - 如何在 Rails 中传递 Bootstrap 变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13396380/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com