Karan
Karan

Reputation: 15114

Rails: Why doesnt all my scss files get compiled?

I am a beginner in rails, and I reckon I haven't got a clear idea on to how the stylesheets should be organised. Currently, I have two files in my assets/stylesheets:

When I run rake assets:precompile - I realise that only application.css is compiled into my public/assets folder. What about home.css?

More Info

I want home.css to load only when the respond is received from my home controller. I have removed *= require_tree . from application.css (since I am guessing that home.css would be included in all other pages - am I right?)

The reason I am trying to figure out a solution for this is because heroku throws the following error:

ActionView::Template::Error (home.css isn't precompiled):
2012-04-29T10:48:20+00:00 app[web.1]:     5:     <meta name="viewport" content="width=device-width">
2012-04-29T10:48:20+00:00 app[web.1]:     7:     = stylesheet_link_tag "application"
2012-04-29T10:48:20+00:00 app[web.1]:     6:     = javascript_include_tag "application"
2012-04-29T10:48:20+00:00 app[web.1]:     8:     = stylesheet_link_tag params[:controller]
2012-04-29T10:48:20+00:00 app[web.1]:     9:     = javascript_include_tag [:controller]
2012-04-29T10:48:20+00:00 app[web.1]:     10:     = csrf_meta_tags
2012-04-29T10:48:20+00:00 app[web.1]:     11:   %body
2012-04-29T10:48:20+00:00 app[web.1]: 
2012-04-29T10:48:20+00:00 app[web.1]:   app/views/layouts/application.haml:8:in `_app_views_layouts_application_haml__2082158123561350666_35885340'
2012-04-29T10:48:20+00:00 app[web.1]: cache: [GET /] miss

Any ideas what the problem/mistake is? Thanks!

Upvotes: 2

Views: 452

Answers (1)

Frederick Cheung
Frederick Cheung

Reputation: 84182

By default only application.css is compile (see the guide). If you want to change what is precompiled, change config.assets.precompile in application.rb, for example

config.assets.precompile += ['home.css']

Upvotes: 5

Related Questions