Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap not work in rails application

I cannot open my application because of this error , i tried to add // *= require "bootstrap-responsive" but this did not work , also i have tried to remove the code from custom and adding it into application then renaming application to application.css.scss , and i tried to rename custom into custom.scss only but i cannot find any solution that work. what i can do ?

Sass::SyntaxError at /
File to import not found or unreadable: bootstrap-responsive.
Load paths:
  Sass::Rails::Importer(/home/dexter/Desktop/Sherif/Triton/app/assets/stylesheets/custom.css.scss)
  /home/dexter/.rvm/gems/ruby-1.9.3-p194/gems/bootstrap-sass-3.0.2.1/vendor/assets/stylesheets
  (in /home/dexter/Desktop/Sherif/Triton/app/assets/stylesheets/custom.css.scss)

Custom.css.scss

// Example using 'Spruce' bootswatch
//
// First import variables
@import "bootswatch/cerulean/variables";

// Then bootstrap itself
@import "bootstrap";

// Bootstrap body padding for fixed navbar
body { padding-top: 60px; }

// Responsive styles go here in case you want them
@import "bootstrap-responsive";

// And finally bootswatch style itself
@import "bootswatch/cerulean/bootswatch";

....

Application.css

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 *= require_self
 *= require jquery.ui.all
 *= require bootstrap-datepicker
 *= require bootstrap-timepicker
 *= require bootstrap_form
 *= require style-metro
 *= require login
 *= require font
 *= require_tree .
 */

Gemfile ( i tried to move bootstrap out of assets group but i did not solve the error also)

group :assets do
  gem 'sass-rails', '3.2.4'
  gem 'bootstrap-sass', '~> 3.0.2.0'
...


end

My error just happened after i pushing my project to github and then cloning it again to use it

like image 568
Mostafa Hussein Avatar asked Nov 13 '13 08:11

Mostafa Hussein


1 Answers

Bootstrap-responsive has been removed since Bootstrap 3.0.

3.0 is mobile first design, and responsiveness is native now.

Remove that require statement, no need now.

Addition

Dexter(OP) finally solved the problem by going back to 2.3. Though the case is rare, I think two lessons can be learned:

  1. Always add version to critical gems.

  2. Always use bundle install or bundle(default to install). Only use bundle update when it's really necessary and you are fully prepared.

like image 78
Billy Chan Avatar answered Sep 27 '22 20:09

Billy Chan