Rails 3.2 bootstrap-sass does not install

I try to install self-tuning gems on my Rails 3.2 application, but run into this error when I call compass install bootstrap :

There is no such structure: "bootstrap"

I have a gem installed in my gemfile:

 gem 'compass', '~> 0.12.2' group :assets do ... gem 'sass-rails', '~> 3.2.4' gem 'compass-rails', '~> 1.0.3' gem 'bootstrap-sass', '~> 2.1.1.0' end 

I put the import statement in the application.css.scss file:

 @import "bootstrap"; 

In my application.js application, I downloaded the boot file:

 //= require jquery //= require jquery_ujs //= require bootstrap ... 

and I needed to download the config.ru file:

 require 'bootstrap-sass' require ::File.expand_path('../config/environment', __FILE__) run MYAPP::Application 

Can anyone understand what might be the problem, or have run into the same problem?

Here is git for bootstrap-sass: https://github.com/thomas-mcdonald/bootstrap-sass.git

+4
source share
4 answers

Figured it out ...

To make the program work, I had to call bundle exec compass install bootstrap . This runs compass install bootstrap in the context of a package that includes all the gems. However, this gave rise to several more problems.

The installation wrote several new bootable javascript files in the directory of my resources / javascripts. In Rails 3.2, they are automatically loaded by the asset pipeline, but in the wrong order, so in my browser console I got error messages for the missing constructor and called a "popover" on the undefined object. After being gouged, the solution was only to delete all the newly created javascript files, since they are already included with //= require bootstrap in application.js.

+2
source

Bootstrap Sass is poorly documented, I need some time to make a workaround. Forget about the compass. Gemfile:

 gem 'bootstrap-sass', '~> 2.1.1.0' gem 'bootswatch-rails' 

use bootswatch-rails gem you can quickly change your themes

in assets / styles, create your_own_sytlesheet.css.scss file

  @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"; // Whatever application styles you have go last //@import "base"; 

you can easily change themes by replacing cerulean with other names.

At least now it works for me.

+4
source

For this you do not need a stone. Just copy the boot files (scss and js files) to your assets. Make sure that application.css.scss no longer has @import 'bootstrap' text; And no need to edit the config.ru file

Also look at the page code. What is displayed in application.css? Do you have a user in your inheritance of the ApplicationController?

0
source

In your gem file, try to save the self-loading outside the asset.

source 'https://rubygems.org'

gem 'rails', '3.2.8'
gem 'bootstrap-sass', '2.1.1'

And then run the command

$ bundle install.

Then check and make sure bootstrap is installed using the command.

package list

0
source

Source: https://habr.com/ru/post/1444753/


All Articles