类似这个问题: rails: any change to custom.css.scss make the app crash
我更改了我的 custom.css.scss 文件,所有对颜色的 Bootstrap 引用都停止工作。我现在已经手动输入了这些颜色的十六进制值并加载了应用程序,但我的导航栏的类现在不起作用。
由于某种原因,我现在似乎在引用任何 Bootstrap 类时遇到问题。我也不明白为什么对样式表进行微小的更改会使我的 Bootstrap 样式崩溃。我想我一定是在其他地方遇到了设置问题。
自定义.css.scss:
@import "bootstrap";
/* mixins, variables, etc. */
$grayMediumLight: #eaeaea;
$gray-darker: #222;
$gray-dark: #333;
$gray: #555;
$gray-light: #999;
$gray-lighter: #eee;
相关 gem
gem 'rails', '4.0.2'
gem 'bootstrap-sass', '2.3.2.0'
gem 'sprockets', '2.11.0'
gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
除此之外,我最近将 bootstrap.css 和 bootstrap.min.css 文件添加到 vendor/assets/stylesheets 和相同的 .js 文件以使用折叠面板类。
非常感谢任何帮助。
应用程序.css:
/*
* 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 bootstrap.min
*= require_self
*= require_tree .
*/
更新:
所以我删除并重新包含了 bootstrap.css 和 bootstrap.min.css 文件,主要的导航栏样式恢复了生机。唯一仍然不起作用的是对导航栏中下拉列表的颜色和样式的引用。
最佳答案
从 vendor/assets/javascript 和 vendor/assets/stylesheets 文件夹中删除 Bootstrap 文件也为我解决了这个问题。
关于css - 对 custom.css.scss 进行微小更改后 Bootstrap 无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23761219/