0

I have seen lots of posts regarding precompiled assets in rails, but I don't think I see one that is related to my specific problem.

My application is complaining that aplication.css.scss is not precompiled.

From what I understand, any *.scss file should be compiled in my rails application when i run:

rake assets:precompile

I even confirmed in my public/assets folder that I can see the compiled application.css file.

However, when I try to visit the first page of my application I get the following error:

Compiled application.css  (1002ms)  (pid 20298)
Started GET "/" for 10.20.1.162 at 2013-01-21 12:21:38 -0500
Processing by MyController#new as HTML
  Rendered business_searches/partials/_form.html.erb (16.6ms)
  Rendered business_searches/new.html.erb within layouts/application (45.6ms)
  Rendered commons/_documenthead.html.erb (34.0ms)
Completed 500 Internal Server Error in 139ms

ActionView::Template::Error (application.css.scss isn't precompiled):
    4: <meta charset="utf-8" />
    5:   <title>My Company Name | <%= @page_title || 'My Company Tagline' %></title>
    6:
    7:  <%= stylesheet_link_tag  "application.css.scss", :media => "all" %>
    8:  <%= javascript_include_tag "application" %>
    9:
    10:
  app/views/commons/_documenthead.html.erb:7:in `_app_views_commons__documenthead_html_erb___1078677729313377561_30352020'
  app/views/layouts/application.html.erb:1:in `_app_views_layouts_application_html_erb___646383708034639720_28260100'

I was able to fix the problem by setting the following variable in my config/environments/production.rb file:

config.assets.compile = true

But according to this post, that is not recommended.

1
  • What is in the application.html.erb line 7, <%= stylesheet_link_tag "application.css.scss", :media => "all" %>? Commented Jan 21, 2013 at 17:54

2 Answers 2

1

I would advice you to keep your manifest file application.css just for managing css assets , and not to prefix it with .scss . The correct syntax for application.html.erb file is :

<%= stylesheet_link_tag  "application", :media => "all" %>

If you've placed some styles in your 'application.css, just create a newcss.scssfile in yourapp/assets/stylesheets` and place them there .

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! Changing to use the correct syntax in application.html.erb did the trick!
I am happy if it has helped you . Good luck.
0

It's because your scss file is having a compile time error. I am quite sure that if you replace it's contents with known valid ones, it will get compiled.

You may comment it and check if it compiles.

Always use 'application.CSS' as base CSS. Others should be separate.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.