Josh
Josh

Reputation: 875

Getting bootstrap-sass bootstrap CSS into production on Heroku

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?

Upvotes: 0

Views: 4338

Answers (2)

Asma Zubair
Asma Zubair

Reputation: 428

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"

Upvotes: 4

hyperrjas
hyperrjas

Reputation: 10744

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!

Upvotes: 2

Related Questions