質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.49%
Cloud9

Cloud9は、クラウドからのプログラミングが可能になるWebサービス。IDEとしての機能が搭載されており、GitHubやHerokuなど他ツールとの連携も可能です。ブラウザ上で動くため、デバイスに関係なく開発環境を準備できます。

Ruby on Rails 5

Ruby on Rails 5は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Bootstrap

BootstrapはウェブサイトデザインやUIのWebアプリケーションを素早く 作成する可能なCSSフレームワークです。 Twitter風のデザインを作成することができます。

Q&A

解決済

1回答

2891閲覧

bootstrapが正しく表示されません

awa

総合スコア34

Cloud9

Cloud9は、クラウドからのプログラミングが可能になるWebサービス。IDEとしての機能が搭載されており、GitHubやHerokuなど他ツールとの連携も可能です。ブラウザ上で動くため、デバイスに関係なく開発環境を準備できます。

Ruby on Rails 5

Ruby on Rails 5は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Bootstrap

BootstrapはウェブサイトデザインやUIのWebアプリケーションを素早く 作成する可能なCSSフレームワークです。 Twitter風のデザインを作成することができます。

0グッド

0クリップ

投稿2019/04/28 09:32

編集2019/04/28 09:38

bootstrap4をcloud9に導入したのですが、
ちゃんと読み込めていないのか、表示が正常ではありません。
例えば、以下画像のリンク箇所(Edit)が、添付画像のような表示になっています。
原因に心当たりがある方は教えていただけませんでしょうか。

↓マウスホバー前↓
イメージ説明

↓マウスホバー時↓
イメージ説明

各種設定ファイルは以下のようになっています。

scss

1【application.scss】 2/* 3 * This is a manifest file that'll be compiled into application.css, which will include all the files 4 * listed below. 5 * 6 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 7 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. 8 * 9 * You're free to add application-wide styles to this file and they'll appear at the bottom of the 10 * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS 11 * files in this directory. Styles in this file should be added after the last require_* statement. 12 * It is generally better to create a new file per style scope. 13 * 14 *= require_tree . 15 *= require_self 16 */ 17// Custom bootstrap variables must be set or imported *before* bootstrap. 18@import "bootstrap";

javascript

1【application.js】 2// This is a manifest file that'll be compiled into application.js, which will include all the files 3// listed below. 4// 5// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 6// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. 7// 8// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 9// compiled file. JavaScript code in this file should be added after the last require_* statement. 10// 11// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 12// about supported directives. 13// 14//= require jquery 15//= require jquery_ujs 16//= require bootstrap 17//= require turbolinks 18//= require_tree .

ruby

1【gemfile】 2# Use SCSS for stylesheets 3gem 'sass-rails', '~> 5.0' 4# Use Uglifier as compressor for JavaScript assets 5gem 'uglifier', '>= 1.3.0' 6# Use CoffeeScript for .coffee assets and views 7gem 'coffee-rails', '~> 4.2' 8# See https://github.com/rails/execjs#readme for more supported runtimes 9# gem 'therubyracer', platforms: :ruby 10 11# Use jquery as the JavaScript library 12gem 'jquery-rails' 13# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 14gem 'turbolinks', '~> 5' 15# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 16gem 'jbuilder', '~> 2.5' 17# Use Redis adapter to run Action Cable in production 18# gem 'redis', '~> 3.0' 19# Use ActiveModel has_secure_password 20# gem 'bcrypt', '~> 3.1.7' 21gem 'bootstrap', '~> 4.1.1' 22# Use Capistrano for deployment 23# gem 'capistrano-rails', group: :development 24 25group :development, :test do 26 # Call 'byebug' anywhere in the code to stop execution and get a debugger console 27 gem 'byebug', platform: :mri 28end 29 30group :development do 31 # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. 32 gem 'web-console' 33 gem 'listen', '~> 3.0.5' 34 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 35 gem 'spring' 36 gem 'spring-watcher-listen', '~> 2.0.0' 37end 38 39# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 40gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

お手数ですが、どうぞよろしくお願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

m.ts10806

2019/04/28 09:33

SCSSをそのまま表示するhtmlに読み込ませているのでしょうか
awa

2019/04/28 09:36

application.scssにbootstrapを記載することで、 全てのファイルにbootstrapを読み込ませようとしている認識です。 bootstrap以外のscssファイルも、application.scssに記述しようかと思っています。 すみません、これで回答になっていますでしょうか。
guest

回答1

0

ベストアンサー

単にbootstrap gem をbundle installしただけでは使えないと思います。sprockets-railsのバージョンが2.3.2以上であることを
$bundle show |fgrep sprockets-rails などで確認してから
SCSSファイルのrequire系の記述を削除、application.jsに
//= require jquery3
//= require popper
//= require bootstrap-sprockets
を追加で動くかどうか確かめてみてください。

Bootstrap Ruby Gem のGithub ここを参考にしてみてください。

投稿2019/05/01 05:06

編集2019/05/01 05:08
shumbow

総合スコア35

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

awa

2019/05/08 16:09

ありがとうございます! 解決できました!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.49%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問