Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS is looking different on heroku

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 http://pltcpal.herokuapp.com/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...

heroku

local host

like image 749
Leahcim Avatar asked Jan 29 '12 20:01

Leahcim


People also ask

Does heroku support CSS?

Heroku allows fast, free web-hosting, but what are the limits? One big one is that they do not natively host static websites with HTML, CSS and JS.

Is heroku a PaaS or IAAS?

Heroku is a Platform as a Service (PaaS), delivering tools that enable software development. Heroku, as a PaaS, allows business to quickly deploy, build, manage, and scale enterprise-level applications while bypassing infrastructure headaches normally required to host an enterprise quality application.


1 Answers

The problem is related to the handling of the asset pipeline on Heroku. There are several ways on how this can be handled, see http://devcenter.heroku.com/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
like image 172
Patrick Frey Avatar answered Sep 22 '22 09:09

Patrick Frey