1
votes

I started a new rails project with bootstrap-sass in the Gemfile.

Ran the following:

bundle install

In my assets/stylesheets/application.css.scss

@import "bootstrap";         

Started rails server

In browser, the link localhost:3000 shows

Showing /Users/XXX/work/YYY/app/views/layouts/application.html.erb where line #5 raised:

couldn't find file 'bootstrap/glyphicons-halflings-regular.eot'
(in /Users/XXX/work/YYY/app/assets/stylesheets/application.css.scss)

Extracted source (around line #5):
<html>
<head>
<title>YYY</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>

Rails.root: /Users/XXX/work/YYY
Application Trace | Framework Trace | Full Trace

app/views/layouts/application.html.erb:5:in
'_app_views_layouts_application_html_erb___1173424794489528152_70210002519360'

Using Rails 4.1.1 and bootstrap-sass 3.1.1 Gemfile:

group :assets do
  gem 'sass-rails', '~> 4.0.3'
  gem 'bootstrap-sass', '~>3.1.1'
end
1
what does your application.css.scss look like?lightswitch05

1 Answers

1
votes

I downloaded the actual assets from the Github page for bootstrap-sass.

  1. Download bootstrap-sass project, copy over everything in the folder "vendor/assets" to the same folder in the project

    https://github.com/twbs/bootstrap-sass

  2. Open config/application.rb, add the following line:

    config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
    
  3. Renamed my app/assets/stylesheets/application.css.scss to custom_bootstrap.css.scss

    mv application.css.scss custom_bootstrap.css.scss
    
  4. Clear cache

    rake tmp:cache:clear
    
  5. Restart rails server