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

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

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby on Rails

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

Bootstrap

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

Q&A

解決済

2回答

5351閲覧

Bootstrapのcssが反映されません

satail

総合スコア31

Ruby on Rails

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

Bootstrap

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

0グッド

0クリップ

投稿2017/03/14 09:17

編集2017/03/14 09:17

Bootstrapのcssが反映されません。
Bootstrapの設定は以下の内容に設定しました。

Gemfile

source 'https://rubygems.org' gem 'rails', '5.0.0.1' gem 'puma', '3.4.0' gem 'sass-rails', '5.0.6' gem 'uglifier', '3.0.0' gem 'coffee-rails', '4.2.1' gem 'jquery-rails', '4.1.1' gem 'turbolinks', '5.0.1' gem 'jbuilder', '2.4.1' group :development, :test do gem 'sqlite3', '1.3.11' gem 'byebug', '9.0.0', platform: :mri end group :development do gem 'web-console', '3.1.1' gem 'listen', '3.0.8' gem 'spring', '1.7.2' gem 'spring-watcher-listen', '2.0.0' end group :test do gem 'rails-controller-testing', '0.1.1' gem 'minitest-reporters', '1.1.9' gem 'guard', '2.13.0' gem 'guard-minitest', '2.4.4' end group :production do gem 'pg', '0.18.4' end gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

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. * *= require_tree . *= require_self */ @import "bootstrap-sprockets"; @import "bootstrap"; /*! * Bootstrap v4.0.0-alpha.6 (https://getbootstrap.com) * Copyright 2011-2017 The Bootstrap Authors * Copyright 2011-2017 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ /*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */ html { font-family: sans-serif; line-height: 1.15; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; } body { margin: 0; } article, aside, footer, header, nav, section { display: block; } . . .

application.js

// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. // // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // //= require jquery //= require bootstrap-sprockets //= require jquery_ujs //= require turbolinks //= require_tree .

application.html.erb

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="description" content=""> <meta name="author" content=""> <title>Bare - Start Bootstrap Template</title> <!-- Bootstrap Core CSS --> <link href="css/bootstrap.min.css" rel="stylesheet"> <!-- Custom CSS --> <style> /* Set top padding of the page to match the height of the navbar */ body { padding-top: 54px; } @media (min-width: 992px) { body { padding-top: 56px; } } /* Ugly hacks to fix the container within navbar functionality - should be fixed in Bootstrap 4 beta */ .navbar-toggler { z-index: 1; } @media (max-width: 576px) { nav > .container { width: 100%; } } </style> </head> <body> <!-- Navigation --> <nav class="navbar fixed-top navbar-toggleable-md navbar-inverse bg-inverse"> <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarExample" aria-controls="navbarExample" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="container"> <a class="navbar-brand" href="#">Start Bootstrap</a> <div class="collapse navbar-collapse" id="navbarExample"> <ul class="navbar-nav ml-auto"> <li class="nav-item active"> <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a> </li> <li class="nav-item"> <a class="nav-link" href="#">About</a> </li> <li class="nav-item"> <a class="nav-link" href="#">Services</a> </li> <li class="nav-item"> <a class="nav-link" href="#">Contact</a> </li> </ul> </div> </div> </nav> <!-- Page Content --> <div class="container"> <div class="row"> <div class="col-lg-12 text-center"> <h1 class="mt-5">A Bootstrap 4 Starter Template</h1> <p class="lead">Complete with pre-defined file paths and responsive navigation!</p> <ul class="list-unstyled"> <li>Bootstrap 4.0.0-alpha.6</li> <li>jQuery 3.1.1</li> </ul> </div> </div> </div> <!-- jQuery Version 3.1.1 --> <script src="js/jquery.js"></script> <!-- Tether --> <script src="js/tether.min.js"></script> <!-- Bootstrap Core JavaScript --> <script src="js/bootstrap.min.js"></script> </body> </html>
ActionController::RoutingError (No route matches [GET] "/js/bootstrap.min.js")

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

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

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

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

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

guest

回答2

0

ベストアンサー

railsは初心者なので、全く間違っているかもしれません。
間違っていたらすみません。

1つめ

以下のサイトを見つけました。
参考 : 音速開発!RailsでBootstrapを導入する方法〜Less、Sass、Scss〜

もしかしたら、以下のgemをインストールすると良いかもしれません。
Gemfileに追記し、bundle installでインストールできます。

gem

1gem 'bootstrap-sass', 2gem 'sass-rails',

2つめ

<link href="css/bootstrap.min.css" rel="stylesheet">ということで、
cssフォルダの中にbootstrap.min.cssファイルはあるでしょうか。

投稿2017/03/14 10:12

programming

総合スコア476

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

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

0

環境を教えてください
production環境でしょうか、development環境でしょうか。
unicorn+nginxでしょうか。webrickでしょうか。

投稿2017/03/16 06:34

redara

総合スコア344

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問