Вопрос

I'm truely new on Rails 4.0. I don't understand the precompilation process when I'm pushing on heroku Cedar stack. I do this :

$> rake assests:precompile
$> git add .
$> git commit -m "foobar" && git push && git push heroku

All seems be working correctly, but my images/css don't seem to be "loaded" (Chrome) on the heroku app (but works perfectly locally) :

Failed to load resource: the server responded with a status of 404 (Not Found) http://xxxapp.herokuapp.com/stylesheets/bootstrap.min.css

I tried something, but I've heard that is was not the good solution. I have modified config/environments/production.rb file and changed :

  config.assets.compile = false

to

  config.assets.compile = true

It works fine, all my images and css are loaded, but I think I missed something.


Also

I tried :

$> rm -rf public/assets
$> git add .
$> git commit -m "foooo" && git push && git push heroku

The precompile process runs well but after, still no images and css loaded on my app.


After edited my Gemfile by adding :

group :production do
    gem 'rails_12factor'
end

images are loaded well but no css..

Это было полезно?

Решение

Heroku should compile the assets for you by default.

You don't need to do anything else.

If you already compiled your assets, you may want to delete them from the public directory and then just push to heroku again.

Другие советы

You should precompile on heroku, not on your computer.

heroku run rake assets:precompile

I don't know, if this is the problem, I did this a year ago.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top