Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku doesnt precompile assets for rails4

The documentation here says that heroku with pre-compile assets during deployement in Rails4.

However , I dont see the precompile assets message.

     Using thin (1.6.1)
       Using twitter-bootstrap-rails (2.2.8)
       Using uglifier (2.3.1)
       Using will_paginate (3.0.4)
       Your bundle is complete! It was installed into ./vendor/bundle
       Bundle completed (1.37s)
       Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
       Detected manifest file, assuming assets were compiled locally
-----> Discovering process types
       Procfile declares types -> (none)
       Default types for Ruby  -> console, rake, web, worker

I am facing issues with bootstrap in my app, where the nav bar wont load properly + some other nuances and I think its the asset precompile issue.

I am using Rails4, Ruby2.0

I have assets enabled in application.rb

config.assets.enabled = true

Precompiling manually did not help

heroku run rake assets:precompile
like image 440
codeObserver Avatar asked Dec 17 '13 05:12

codeObserver


1 Answers

Had this same problem. I had precompiled locally for some reason and then pushed to Heroku.

Saw Heroku give the line "Detected manifest file, assuming assets were compiled locally" which made me realize it wasn't precompiling all the things.

When I did a "git add ." and committed, I saw that it was adding a bunch of public files. Pushing that to Heroku got it to work. So I had to precompile and git add everytime, basically doing Heroku's work for it and making a mess in my public folder. It got the job done, but was a poor fix.

I looked for the "manifest" that heroku mentioned and eventually found a ".sprockets-manifest..." file in the public directory.

Deleted that and Heroku was once again my friend.

Found this question as part of my research so I thought I'd share what I found in case anyone else sees this, or has any elaborational thoughts.

Now I have to go and see if .sprockets-manifest was important to anything else ....

like image 174
hsidar Avatar answered Sep 19 '22 19:09

hsidar