1
votes

I am trying to install the bootstrap-sass gem. I am using RubyMine as an IDE and rails 4.1.0. My gem file looks like:

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.0'


gem 'sprockets', '2.11.0'

gem 'autoprefixer-rails'
gem 'sass-rails'
gem 'bootstrap-sass','3.2.0'


gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'haml'

gem 'sdoc', '~> 0.4.0',          group: :doc

group :development do
  gem 'spring'
  gem 'sqlite3'
  gem 'byebug',      '3.4.0'
  gem 'web-console', '2.0.0.beta3'
end


group :production do
  gem 'pg', '0.17.1'
  gem 'rails_12factor', '0.0.2'
end

I am getting an error for a missing file reference when adding the following lines to my application.css.scss file:

@import "bootstrap";
@import "bootstrap-sprockets";

If I change to an earlier version of bootstrap-sass like 2.3.2, I can get the first import statement (@import "bootstrap") to work, but the second still fails. Likewise for my application.js file the line //= require bootstrap-sprockets throws an error that the file is not found. My application.css.scss is:

/*
 * 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 bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any styles
 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
 * file per style scope.
 *
 *= require_tree .
 *= require_self
 */
@import "bootstrap";
@import "bootstrap-sprockets"; 
1

1 Answers

0
votes

I have the same errors on Rubymine however the app works fine and no errors thrown at runtime. Obviously a Rubymine bug

Update 1:

I had a quick look into the gem source code. It just uses some custom asset_path settings rather then defaults. So Rubymine can't detect where the main asset file are

Update 2: sprockets comes before bootstrap, see Github Readme and require_self should be before require_tree (as you first want to load the bootsrap css files and then all the other css files)

/*
*= require_self
*= require_tree .
*/


@import "bootstrap-sprockets";
@import "bootstrap";