2017-01-09 2 views
0

Или они есть? Когда я использую элемент проверки на любом компоненте начальной загрузки, он берет CSS из application.css (а не сам bootstrap). Я почти уверен, что я сделал что-то неправильно при установке, хотя несколько раз прохожу через рекомендации.Bootstrap v4 Устранение неполадок в Rails

Забыл добавить, я использую Rails 4.2.6 и используя камень от: https://github.com/twbs/bootstrap-rubygem#a-ruby-on-rails

Это то, что я имею в виду, например, классы BTN работают, но они не указывают на Bootstrap в инспектировать элемент а скорее на application.css. Также navbar (скопировать пасту с getbootstrap.com) работает до тех пор, пока выпадающие окна javascript не исчезнут, но CSS отключен. enter image description here

Gemfile

#Bootstrap V4 Alpha 
gem 'bootstrap', '~> 4.0.0.alpha6' 
* sprockets-rails (3.2.0) 

application.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 any plugin's vendor/assets/stylesheets directory 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 bottom of the 
* compiled file so the styles you add here take precedence over styles defined in any styles 
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new 
* file per style scope. 
* 
*/ 

@import "bootstrap"; 

application.js

// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 
// about supported directives. 
// 
//= require jquery 
//= require jquery_ujs 
//= require turbolinks 
//= require_tree . 
//= require bootstrap 

ответ

1

В вашем application.js файл месте //= require bootstrap после //= require jquery поэтому файл будет выглядеть как это:

// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 
// about supported directives. 
// 
//= require jquery 
//= require bootstrap 
//= require jquery_ujs 
//= require turbolinks 
//= require_tree . 

Перезапустите rails server и изменение вступит в силу.

+0

Спасибо за ответ, я пытался но ничего не изменилось. – Dotol

0

Присмотритесь к комментариям вашего приложения.

* This is a manifest file that'll be compiled into application.css, which will include all the files 
* listed below. 

Вот почему кажется, как будто все CSS исходит из application.css, но вы импортируете самозагрузки CSS в нижней части файла ..

+0

Я переместил оператор импорта, но ничего не изменилось. – Dotol

+0

попробуйте удалить турбонауки – disc0ninja

Смежные вопросы