I'm using twitter bootstrap in my Rails application. It works well in development mode but does not in production. Here is the Gemfile
source 'https://rubygems.org'
ruby '1.9.3'
gem 'rails'
gem 'jquery-rails'
gem 'haml-rails'
gem 'devise'
gem 'bcrypt-ruby'
gem 'curb'
gem 'nokogiri'
gem 'pg'
group :assets do
gem 'sass-rails'
gem 'twitter-bootstrap-rails'
gem 'uglifier'
end
When I run it as rails s -e production it gives me the error of
ActionView::Template::Error (couldn't find file 'twitter/bootstrap'
(in /home/alex/Documents/ruby_projects/p1/app/assets/javascripts/application.js:15)):
Application.js
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require_tree .
production.rb
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
# Generate digests for assets URLs
config.assets.digest = true
Somebody suggested me to remove gem 'twitter-bootstrap-rails'
which I cannot do because I use it or move it outside of group assets which didn't help me either: the application well except the fact that twitter bootstrap files (js and css) weren't loaded at all.
How do I fix it?
UPDATE:
If I use use //= require bootstrap
instead of //= require twitter/bootstrap
then it gives me cannot load such file -- less (in home/alex/Documents/ruby_projects/pr1/app/assets/stylesheets/bootstrap_and_overrides.css.less)
despite the fact that the file exists.
And if I rename css.less to css
, then I get the next error couldn't find file 'bootstrap_and_overrides' (in /home/alex/Documents/ruby_projects/pr1/app/assets/javascripts/application.js:15)
I solved this issue by using following steps:
Update twitter-bootstrap-rails gem version 2.2.6 or just paste below line in your gemfile.
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
(or)
if twitter-bootstrap-rails 2.2.6 is not working then Use twitter-bootstrap-rails gem latest version.