0

I'm using the bootstrap-sass gem with my rails (3.2.5) app, and things are working great in my local dev environment. But when I deploy to prod on Heroku the bootstrap CSS isn't included in the compiled assets.

I added bootstrap-sass and sass-rails to my Gemfile:

gem 'bootstrap-sass', '2.0.3.1'

group :assets do
  gem 'sass-rails',   '3.2.4'
end

And I added an import for Bootstrap to a custom.css file in my assets dir:

@import "bootstrap";

Basic stuff. Any idea why this isn't working in Prod?

4

2 に答える 2

4

I was running into exact same problem. These are the steps I followed to resolve the issue:

  1. Add " *= require bootstrap" right above " *= require_tree ." in application.css.

  2. Then I did "bundle install --without production"

  3. Then I ran "rake assets:precompile"

  4. Then I did git add .

  5. Then I committed the changes git commit -m "blah..."

  6. Then push changes to production "git push heroku master"

于 2013-09-24T18:10:45.107 に答える
2

You must add a bootstrap_and_overrides.css.scss file in your app/assets/stylesheets with the next:

// Set the correct sprite paths
$iconSpritePath: asset-url('glyphicons-halflings.png', image);
$iconWhiteSpritePath: asset-url("glyphicons-halflings-white.png", image);

@import "bootstrap";
@import "bootstrap-responsive";

Also, you must add in your application.js:

//= require bootstrap 

Regards!

于 2012-06-19T08:03:49.880 に答える