Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Precompiled CSS File not found with rails 4 asset pipeline

I'm starting in rails and I've got an application that is working in dev (webrick).

The problem is: the precompiled CSS file is not found in production.

Now I host it on heroku and deploy it. I have a message saying that assets are precompiled (so it's not a compilation error) and everything is by-default for settings.

I've ls the /public/assets folder and everything is in there. I can even cat the application-*.css file and I get the full content I should have.

Now when I try to access the CSS file it gives me an error 404 (even tho it's an auto-generated css link using <%= stylesheet_link_tag "application", :media => "all" %>). So definetly it's not a problem that I did hardcode the CSS link.

I'm not exactly sure on what would be the next check to perform.

If you're curious on the output, it is currently publicly accessible here.

like image 758
Erick Avatar asked Jul 30 '13 16:07

Erick


2 Answers

Try changing the configuration option config.serve_static_assets = false to config.serve_static_assets = true in your config/environments/production.rb if you haven't already done that.

like image 152
vee Avatar answered Sep 20 '22 10:09

vee


The only thing that fixed it for me in Rails 4 was

config.assets.compile = true

in config/environments/production.rb

This would fall back to the assets pipeline if a precompiled asset is missed, according to the documentation.

like image 37
Abdo Avatar answered Sep 21 '22 10:09

Abdo