1

I've searched through this group and the rest of the Web and found bits and pieces of a solution to my problem, but haven't found anything that really works.

Here is my issue. I'm running Rails 3.1 and deploying to the Heroku cedar stack.

I have Blueprint in my assets/stylesheets directory.

When I try adding this to my application template:

  <%= stylesheet_link_tag 'blueprint/screen', :media => "screen, 
projection" %> 
  <%= stylesheet_link_tag 'blueprint/print', :media => "print" %> 

And run this at my command prompt:

RAILS_ENV=production bundle exec rake assets:precompile 

And then deploying I'm getting an error on Heroku that says "blueprint/ screen.css isn't precompiled", yet when I look in the public/assets directory it's there and it's appearing in the manifest. I get this error even if I run the precompile locally before committing and deploying.

If I don't put anything in my application template and let Rails find Blueprint, I'll run the precompile manually, deploy and Heroku will load the site. So that's alright.

However, I'm getting the URL path on every link. Some reading shows that I need to add ":media => "print" and "screen, projection" to my template, but every time I add the lines to the template Heroku won't load at all because the files aren't precompiled even if I've precompiled them.

All help is greatly appreciated.

Scott S.
  • 749
  • 1
  • 7
  • 26

2 Answers2

0

I would guess that your assets aren't in Git if you're running the command locally. I don't think adding assets to git is generally a good idea, as the general consensus is that it's more trouble than it's worth:

Should I store generated code in source control

For more information on the asset pipeline and Heroku see here:

http://devcenter.heroku.com/articles/rails31_heroku_cedar#the_asset_pipeline

Personally, I leave the assets to a post-deploy pre-compile and then use the asset_sync gem to push the files to S3 for serving. More information on this is here:

http://devcenter.heroku.com/articles/cdn-asset-host-rails31

Community
  • 1
  • 1
Neil Middleton
  • 22,105
  • 18
  • 80
  • 134
  • Thanks for the response. I found a solution that fixes 90% of the issue. I changed line 18 of production.rb to: "config.assets.compile = true" and removed the lines in the application.html.erb and that fixed the Heroku issue. I'm still working on the link paths being shown. – Scott S. Dec 28 '11 at 04:38
0

In addition to the steps you mention, did you remember to add the public/assets directory to your git repository before you pushed to Heroku?

I was having the same problem as you until I read the same article Neil mentions, which reminded me of this simple step that I had forgotten.

http://devcenter.heroku.com/articles/rails31_heroku_cedar

Charles Worthington
  • 1,110
  • 8
  • 11