我尝试将引导变量传递给 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;
in_myvars.scss
并尝试在其中使用它时custom.css.scss
它不起作用 - 页面无法加载并且我得到一个Undefined variable: "$testVar".
-Error
它在直接定义变量时有效,custom.css.scss
但我宁愿有一个包含所有变量的概述文件(就像我以前使用 TB 作为独立时一样)。我对 Rails 很陌生,所以请耐心等待 :)
提前致谢!