2017-01-09 6 views
0

またはそれはありますか?どのブートストラップコンポーネントでもinspect要素を使用すると、CSSをapplication.cssから取得します(ブートストラップ自体ではありません)。私はガイドラインを何度か読んでもインストール時に間違ったことをしていました。 https://github.com/twbs/bootstrap-rubygem#a-ruby-on-railsブートストラップv4 Railsへのインストールの問題

これは私が例えばBTNクラスが作業している、何を意味するかですが、彼らはブートストラップの要素を検査するために指していない:

は、私はRailsの4.2.6を使用してから宝石を使用しています追加するのを忘れむしろ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 //= require jquery後のあなたのapplication.jsファイルの場所//= require bootstrap

// 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

ので、ファイルは一見になります

// 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

application.cssファイルのコメントをよく見てください。すべてのCSSはapplication.cssから来ているかのようにそれが表示されますが、あなたは、ファイルの一番下にあるブートストラップCSSをインポートしている理由です

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

...返信用

+0

私はimportステートメントを移動しましたが、何も変更されませんでした。 – Dotol

+0

ターボリンクを取り外してみる – disc0ninja

関連する問題