Search code examples
ruby-on-railsstylesheetasset-pipeline

Rails stylesheets placed in assets don't show on website


I have a set of custom stylesheets in assets/stylesheets/xxx folder.

I have a custom application_xxx.css.scss file in assets/ that requires all of those.

I have a custom layout xxx_application.html.haml which includes:

    = stylesheet_link_tag 'application_xxx'

Everything works nicely in development, when I push everything now to the testing server none of the stylesheets are working. it gives a msg "Failed to load resource application_xxx.css "

Do I have to place my custom folder and custom application file in the public directory instead?


Solution

  • Have you precompiled assets?

    bundle exec rake assets:precompile
    

    You don't need to manually move any any custom css or js. Precompile your assets then try pushing again.

    My production.rb file has these relevant lines:

    config.assets.precompile += %w( application-all.css application-print.css )
    config.assets.compile = false
    config.serve_static_assets = false