CSS在heroku看起来不同

编程入门 行业动态 更新时间:2024-10-21 07:53:41
本文介绍了CSS在heroku看起来不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

正如你应该在下面的图片中看到的,我的本地主机站点上的css在顶部比在heroku上更好地隔开。

以前有人有这种类型的问题。您可以在此页面上查看最佳

我通过在我的计算机上本地预编译资源,然后将它们推送到Heroku来修复我的应用程序中的问题。

预编译资产:

RAILS_ENV = rake assets:precompile

将更改添加/提交到git存储库:

git add public / assets git commit -mvendor compiled assets git push -f heroku heroku-assetpipeline:master

As you should see in the images below, the css on my local host site is spaced much better at the top than it is on heroku.

Has anyone had this type of problem before. You can see it best on this page pltcpal.herokuapp/forums/

I'm using Twitter bootstrap, which recommends adding

`padding-top: 40px;`

to body if using the top nav bar. Somehow it's not working...

解决方案

The problem is related to the handling of the asset pipeline on Heroku. There are several ways on how this can be handled, see devcenter.heroku/articles/rails31_heroku_cedar

I fixed the issue in my application by pre-compiling the assets locally on my machine and then pushing them to Heroku.

Pre-compile the assets:

RAILS_ENV=production bundle exec rake assets:precompile

Add/commit the changes to git repository:

git add public/assets git commit -m "vendor compiled assets"

To be safe I tested the whole thing on a local branch on my machine first which I pushed to Heroku using the following command (Heroku normally ignores all branches except the master branch, thus the trick):

git push -f heroku heroku-assetpipeline:master

更多推荐

CSS在heroku看起来不同

本文发布于:2023-11-13 00:43:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1582942.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:CSS   heroku

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!