Reputation: 973
I´m learning Ruby on Rails and tried to implement Twitter Bootstrap. I know how to use and edit it, as I used it before - just without rails.
Setup was done, as suggested here: http://ruby.railstutorial.org/chapters/filling-in-the-layout?version=3.2#sec-custom_css - As I read this book.
The following error occurs: File to import not found or unreadable: bootstrap.scss.
while trying to import @import "bootstrap"
.
Here is my gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3-ruby'
gem 'bootstrap-sass', '~> 2.1.1.0'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
...
What do I wrong? Thank you in advance!
Edit:
Do I have to install "Compass" aswell? When checking with gem server
I find under "bootstrap-sass" bootstrap-sass 2.1.1.0 [rdoc] [www] - depends on compass, sass-rails.
Upvotes: 1
Views: 1892
Reputation: 260
I just followed the instruction in the link you provided and had no problem using bootstrap. I only did following steps:
1) edited the Gemfile so that the assets group would look like:
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'bootstrap-sass', '~> 2.1.1.0'
gem 'uglifier', '>= 1.0.3'
end
2) created the file app/assets/stylesheets/custom.css.scss
and placed the following line:
@import 'bootstrap';
3) generated a scaffold:
rails g scaffold posts title:string body:text date:date
4) migrated the database:
rake db:migrate
5) fired up the server
rails s
6) visit the posts page
http://localhost:3000/posts
You can view the view the generated css:
http://localhost:3001/assets/custom.css
where the bootstrap css is folded in.
Upvotes: 5
Reputation: 9701
gem 'bootstrap-sass', '~> 2.1.1.0'
should be out of the :assets
group. Just place it below gem 'sqlite3-ruby
' and run bundle install
again.
Upvotes: 3