Relevant part of GemFile:
Bundle install:
And still no effect:
From appviewslayoutsapplication.html.erb:
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
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. JavaScript code in this file should be added after the last require_* statement.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require turbolinks
//= require_tree .
How do I load Bootstrap styling?
2
Answers
Seems youre missing to import bootstrap styles. To solve this according to the
bootstrap-sass
documentation you should:Import Bootstrap styles in
app/assets/stylesheets/application.scss
bootstrap-sprockets must be imported before bootstrap for the icon fonts to work.
Make sure the file has .scss extension (or .sass for Sass syntax). If you have just generated a new Rails app, it may come with a .css file instead
First you should decide which gem to use,
twitter-bootstrap-rails
orbootstrap-sass
, not both.Let’s say you use
bootstrap-sass
then in yourapplication.js
should be//= require bootstrap-sprockets
not
//= require twitter/bootstrap
and then add
to your
app/assets/stylesheets/application.scss
like R. Sierra said.Now your app should be good to go!