CSS loading locally but not in Heroku for rails application

I follow the instructions for preparing a rail preview. Bootstrap worked fine for the hero, but then I modified the bootstrap_and_override file to include the logo. When you start the rail server locally and view the style as I expected, with the download, and a new header appears.

As before, I used rake assets: precompiled and clicked on git - after this tutorial http://railsapps.github.com/rails-heroku-tutorial.html , which worked until the css was shown to the hero. It shows html, but it looks like css and bootstrap are missing.

Does anyone have any ideas?

+48
css ruby-on-rails twitter-bootstrap heroku
04 Oct '12 at 2:30
source share
9 answers

Run bundle exec rake assets:precompile in your local code

Commit the changes and deploy to heroku

+70
Aug 29 '13 at 19:11
source share

Had the same problem, I don’t know if it will help others in the future, but I got this on my β€œgit push heroku master” push:

PRECAUTIONS:

  Include "rails_12factor" gem to enable all platform features 

Updated my gemfile,

  *group :production, :staging do gem 'pg' gem 'rails_12factor' end* 

Previously, to my delight, he installed them:

  Installing rails_serve_static_assets (0.0.1) Installing rails_stdout_logging (0.0.1) Installing rails_12factor (0.0.2) 

After that, the site worked perfectly. Hope someone helps, I'm new to all of this.

+43
Jun 27 '13 at 15:28
source share

Make sure that you are set to true in /config/environments/production.rb

config.cache_classes = true config.serve_static_assets = true config.assets.compile = true config.assets.digest = true

git add, git commit and click on the hero.

+18
Sep 01 '14 at 1:33
source share

If you are using sass ... before moving on to all these other problems ... make sure that you do not mix the .css and .scss files in the folder with your resources.
Geroku seems to have trouble mixing the two when compiling assets. I can’t explain why, if this is an exact explanation ... but, in my own experience, all I had to do to fix this was just rename any .css files to .scss.

+5
Nov 22 '14 at 20:49
source share

I thought about it, having tried everything that stackoverflow has to offer. I just checked the git status, saw that I have a bunch of unfixed files (I think that this would be taken with git push heroku master), then added, committed and clicked on git. Then I started, installed the package, pre-compiled the assets and deployed to heroku, and it works.

+4
Oct 05
source share

I have the same problem in rails4 fixed with the addition of a. gem 'rails_12factor' b. bundle exec rake assets:precompile

+2
Jul 03 '15 at 6:48
source share

To load assets in a production environment:

How to load assets on production rails

Note: After the following link

 rm -rf tmp/* rm -rf public/assets/* RAILS_ENV='production' rake assets:precompile 

then restart the server

+1
Nov 08 '15 at 10:14
source share

I just ran into similar problems with the application. Check out this post ...

0
Oct 05 '12 at 12:15
source share

I had to run heroku run rake css:rebuild

-2
Feb 06 '15 at 15:29
source share



All Articles