简体   繁体   中英

Rails custom.css not working when deployed to Heroku

Any idea why my custom.css would work perfectly in my development environment, but not work when deployed to Heroku? Things that have the property display: none; are appearing when deployed, but are appropriately hidden when in development.

Thanks!

Sounds like you are having problems with the asset pipeline. Check out:

https://devcenter.heroku.com/articles/rails-asset-pipeline

Are you letting Heroku precompile your assets? Personally, I precompile all my assets before deploying to Heroku.

RAILS_ENV=production bundle exec rake assets:precompile

This will precompile all your assets and puts it under a public/assets folder. Then you can just add them to git and push to heroku.

If you do this you will be compiling manually, and you should run the precompile line before you re-deploy or update your Heroku app to catch any changes you've made in the asset pipeline.

You can check belows - expire browser cache. - check assets are deploy well. (access to css url directly)

I think that case is almost come from cache.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM