Rails custom.css部署到Heroku时不工作 [英] Rails custom.css not working when deployed to Heroku

查看:164
本文介绍了Rails custom.css部署到Heroku时不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何想法为什么我的custom.css将在我的开发环境中完美工作,但不部署到Heroku时工作​​?有属性显示的东西:none;

解决方案

div>

听起来你有资产管道的问题。签出:



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



您是否让Heroku预编译您的资产?

  RAILS_ENV = production bundle exec rake assets:precompile 

这将预编译您的所有资产,并将其置于 public / assets 文件夹。然后你可以将它们添加到git并推送到heroku。



如果这样做,您将手动编译,并且您应该运行预编译行,然后重新部署或更新您的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.

这篇关于Rails custom.css部署到Heroku时不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆