Bootstrap not working after minor change to custom

2019-06-01 03:12发布

Similarly to this issue: rails: any change to custom.css.scss make the app crash

I have made a change to my custom.css.scss file and all the bootstrap references to colors stopped working. I have manually entered the hex values for these colors now and the app loads, but the classes for my navbar are now not working.

It seems that I have a problem referencing any of the bootstrap classes now for some reason. I also do not understand why making a minor change to a stylesheet has sent my bootstrap styles into a meltdown. I think I must have a setup problem elsewhere.

custom.css.scss:

@import "bootstrap";

/* mixins, variables, etc. */

$grayMediumLight: #eaeaea;
$gray-darker: #222;
$gray-dark: #333;
$gray: #555;
$gray-light: #999;
$gray-lighter: #eee;

Relevant gems

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'

In addition to this, I recently added the bootstrap.css and bootstrap.min.css file to vendor/assets/stylesheets and the same .js files to use a collapsing panel class.

Any help much appreciated.

application.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 .
 */

UPDATE:

So I removed and then re-included the bootstrap.css and bootstrap.min.css files and the main navbar styles came back to life. The only things that are still not working are the references to colors and the styles for my drop-down list in the navbar.

1条回答
做自己的国王
2楼-- · 2019-06-01 04:04

removing bootstrap files from the vendor/assets/javascript and vendor/assets/stylesheets folders solved this issue for me too.

查看更多
登录 后发表回答