Bootstrap is not styling anything

2019-09-02 10:42发布

问题:

I am using Bootstrap but it is not styling anything for some reason.

I've tried pasting the bootstrap code for forms and navbars into my home view and it just shows like normal without the bootstrap styling.

I have

@import "bootstrap"; in my stylesheet

and the appropriate gems in my Gemfile. Is there some part of the setup that I am forgetting? Or why would it not be working. I've used it in past projects just a few days ago but not sure why it is not styling anything this time around.

This is my GEMfile:

source 'https://rubygems.org'


gem 'bootstrap-sass', '~> 3.1.1'

gem 'simple_form'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.3'

# Use sqlite3 as the database for Active Record
gem 'sqlite3'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.1.2'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano', group: :development

回答1:

make sure you bundle install or bundle(default to install) and add version to critical gems.

Also try

rake temp:clear


回答2:

I didn't rename my application.css file to application.css.scss this was my problem :/ Fixed now though!