After adding 'bootstrap-sass' when I am trying to install it i.e by rails g bootstrap:install, I am getting following message.
"Could not find generator bootstrap:install"
Am I missing anything?
Thanks
My Gemfile below:
source 'https://rubygems.org'
gem 'rails', '4.0.0'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
group :doc do
gem 'sdoc', require: false
end
gem "rspec-rails", :group => [:development, :test]
gem "database_cleaner", :group => :test
gem "email_spec", :group => :test
gem "cucumber-rails", :group => :test, :require => false
gem "launchy", :group => :test
gem "capybara", :group => :test
gem "factory_girl_rails", :group => [:development, :test]
gem "devise"
gem "quiet_assets", :group => :development
gem "figaro", ">= 0.5.3"
gem "better_errors", :group => :development
gem "binding_of_caller", :group => :development
gem 'bootstrap-sass'
There are no generators included with bootstrap-sass, which is why you're getting an error.
It uses the asset pipeline to make the Bootstrap assets available, so they don't have to be installed into your application. You will need to #import "bootstrap"; at the top of your application SCSS file.
Related
I've been getting the following error after trying to install the bootstrap gem. I've followed the advice found elsewhere but it doesn't seem to be working. I definitely always remember to restart my server after bundle install but I'm still having trouble.
Showing /home/ubuntu/workspace/sample_app/app/views/static_pages/home.html.erb where line #13 raised:
File to import not found or unreadable: bootstrap-sprockets.
Gemfile:
source 'https://rubygems.org'
gem 'rails', '5.0.0'
gem 'bootstrap-sass', '3.3.6'
gem 'puma', '3.4.0'
gem 'uglifier', '3.0.0'
gem 'coffee-rails', '4.2.1'
gem 'jquery-rails', '4.1.1'
gem 'turbolinks', '5.0.0'
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
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
aplication.css.scss
*...
* It is generally better to create a new file per style scope.
*
*/
#import "bootstrap-sprockets";
#import "bootstrap";
application.js
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
Thanks for any help!
Add the to the Gemfile the gem sass-rails:
gem 'bootstrap-sass', '~> 3.3.6'
gem 'sass-rails', '>= 3.2'
Check the docs at https://github.com/twbs/bootstrap-sass#a-ruby-on-rails
I am using Rails 4.2.0 and all of a sudden my style tag in my application.html.erb layout doesn't render the application.css anymore.
In my layout I have:
<%= stylesheet_link_tag 'application', media: 'all' %>
Which produces this error:
Showing /****/app/views/layouts/application.html.erb where line #5 raised:
TypeError: undefined is not an object (evaluating 'processor.process')
(in /****/app/assets/stylesheets/application.scss)
Which line 5 is simply the stylesheet_link_tag above.
If it helps my Gem file looks like this:
gem 'rails', '~> 4.2.0'
gem 'mysql2'
gem 'sass-rails'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'bootstrap-sass'
gem 'bootstrap_form'
gem 'autoprefixer-rails'
gem 'bcrypt-ruby', :require => 'bcrypt'
gem 'lodash-rails'
gem 'angular-rails-templates'
gem 'mini_magick'
gem 'refile', require: ['refile/rails', 'refile/image_processing']
gem 'aws-sdk'
gem 'RedCloth'
gem 'sass-json-vars'
Removing the stylesheet_link_tag makes the application run fine. Keeping the tag but emptying the application.scss file does not.
Any ideas?
To fix the process error, add therubyracer to your Gemfile. Credit to this S.O. question.
gem 'therubyracer', platforms: :ruby
and to fix the Bootstrap glyphicons issue, import bootstrap-sprockets prior to importing Bootstrap or custom variables in your application.scss
#import 'bootstrap-sprockets';
For reference to missing icons, here is a nice snippet from the Bootstrap-sass README.
I added the surveyor gem and but it breaks my css (built almost entirely with bootstrap). How to deal with this?
Without surveyor:
With surveyor:
Below is my gemfile:
source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0
gem 'rails', '4.0.5'
gem 'bootstrap-sass', '2.3.2.0'
gem 'sprockets', '2.11.0'
gem 'bcrypt-ruby', '3.1.2'
gem 'faker', '1.1.2'
gem 'will_paginate', '3.0.4'
gem 'bootstrap-will_paginate', '0.0.9'
gem "paperclip", "3.5.3"
gem "aws-sdk"
gem 'whenever', :require => false
gem 'factory_girl_rails', '4.2.1'
gem 'd3-rails'
gem 'figaro'
gem 'rename'
group :development do
gem "letter_opener"
end
group :test do
gem 'selenium-webdriver', '2.35.1'
gem 'capybara', '2.1.0'
gem 'cucumber-rails', '1.4.0', :require => false
gem 'database_cleaner', github: 'bmabey/database_cleaner'
end
group :development, :test do
gem 'sqlite3', '1.3.8'
gem 'rspec-rails', '2.13.1'
end
gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'jquery-datetimepicker-rails'
gem 'jquery-turbolinks'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
group :doc do
gem 'sdoc', '0.3.20', require: false
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
gem 'newrelic_rpm'
end
The answer can be found here enter link description here. Basically surveyor_all.css in app/assets/stylesheets is overriding bootstrap somehow.
Just remove require_tree . and include your custom.css.scss manually. Even without the surveyor_all.css being included it seems like that surveys appear fine.
I created new Rails app, then added gem 'rspec-rails' to Gemfile, bundle install-ed, and launched
rails g rspec:install
create .rspec
create spec
create spec/spec_helper.rb
Why it didn't create spec/rails_helper.rb ?
My Gemfile is being generated with new Rails aplication with empty lines and comments removed. I only added the last line to it.
source 'https://rubygems.org'
gem 'rails', '4.0.3'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
group :doc do
gem 'sdoc', require: false
end
gem 'rspec-rails'
rails_helper.rb is new to Rspec Rails 3.x. You may be running an earlier version. Check your Gemfile.lock or run bundle list | grep rspec-rails to see which version you're running.
I think it's because it needs to be in both :development and :test
It should be:
group :development, :test do
gem 'rspec-rails', '~> 6.0.0'
end
I have a rails app that was built with the Bootstrap rails gem for development, but now I am going to start doing design and styling stuff and I would rather just move to referencing bootstrap normally/locally. The app is based on the rails3-bootstrap-devise-cancan template.
I tried just removing the bootstrap-sass gem and then deleting all of the stylesheets and .js files in /assets, and replacing the application.css and application.js with bootstrap.css and bootstrap.js. But when I launch the application, I can see it is grabbing certain things from bootstrap, but the formatting is wrong and a lot of interface things don't work.
What is the easiest cleanest way to make the switch?
source 'https://rubygems.org'
gem 'rails', '3.2.13'
gem 'sqlite3'
gem 'mysql2'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem "rspec-rails", ">= 2.12.2", :group => [:development, :test]
gem "database_cleaner", ">= 1.0.0.RC1", :group => :test
gem "email_spec", ">= 1.4.0", :group => :test
gem "cucumber-rails", ">= 1.3.1", :group => :test, :require => false
gem "launchy", ">= 2.2.0", :group => :test
gem "capybara", ">= 2.0.3", :group => :test
gem "factory_girl_rails", ">= 4.2.0", :group => [:development, :test]
gem "bootstrap-sass", ">= 2.3.0.0"
gem "devise", ">= 2.2.3"
gem "cancan", ">= 1.6.9"
gem "rolify", ">= 3.2.0"
gem "simple_form", ">= 2.1.0"
gem "quiet_assets", ">= 1.0.2", :group => :development
gem "figaro", ">= 0.6.3"
gem "better_errors", ">= 0.7.2", :group => :development
gem "binding_of_caller", ">= 0.7.1", :group => :development, :platforms => [:mri_19, :rbx]
gem 'execjs'
gem 'jquery-rails'
gem 'jquery-ui-rails'
The bootstrap-less gem should not affect the files in your own app/assets folder, instead they are fetched from each gem's corresponding folders. My guess is that the CSS/JS assets you deleted were not put there by the gem, but by you or someone else working on the project.
Instead of replacing application.css and application.js with the Bootstrap files, you should add them to your assets folder and import them into the application files. Thus, if you have any other assets, they can too be imported into the same files.
Usually, all files in the same folder are automatically imported. My application.css by default includes this comment which instructs it to include all CSS files in the same directory tree:
*= require_tree .
You should probably read up on how the Asset Pipeline works, that makes it easier to find out where the problem lies.