CSS loading locally but not in Heroku for a rails app

后端 未结 11 1803
梦谈多话
梦谈多话 2020-12-04 09:12

I\'m following a rails prelaunch signup tutorial. Bootstrap was working fine deployed on heroku, but then I modified the bootstrap_and_override file to include a logo. Whe

相关标签:
11条回答
  • 2020-12-04 09:58

    To load assets in production environment:

    How to load assets in production rails

    Note: After following above link

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

    then restart your server

    0 讨论(0)
  • 2020-12-04 09:59

    This is a long shot, but if you're using Chrome try pressing Ctrl+Shift+R to reload the page as Chrome can sometimes cache old CSS settings.

    0 讨论(0)
  • 2020-12-04 10:00

    This issue can also happen when you are cloning an app and using a CDN for your assets.

    Comment out config.action_controller.asset_host in production.rb if your heroku app is a staging site.

    0 讨论(0)
  • 2020-12-04 10:01

    If your using sass...before you go through all this other trouble...make sure your not mixing .css and .scss files in your assets folder.
    Heroku seems to have some trouble mixing the two when compiling assets. I can't explain why of if its an accurate explanation...but, in my own experience all I had to do to fix this was simply rename any .css files to .scss.

    0 讨论(0)
  • 2020-12-04 10:02

    I had to run heroku run rake css:rebuild

    0 讨论(0)
提交回复
热议问题