ActionView::Template::Error (960.css isn't precompiled) ActionView::Template::Error (960.css isn't precompiled) heroku heroku

ActionView::Template::Error (960.css isn't precompiled)


Style sheets that are not included in a manifest (directly by name or indirectly via require_tree) are not precompiled, so will not accessible in production.

You need to add the sheet to the list of items to precompile in the environment application.rb.

config.assets.precompile += ['960sm.css']

And then access it in the view:

stylesheet_link_tag('960sm')


Instead of managing a list of CSS files, you may prefer to simply adjust the extension by adding .scss to the filename.

Hence, 960sm.css would become 960sm.css.scss.

This should not break anything as valid CSS is valid SCSS.


If you have a lot of standalone assets, then instead of adding each one to the list, like this

config.assets.precompile += ['960sm.css']

you may want to just precompile everything, like this:

def precompile?(path)  %w(app lib vendor).each do |asset_root|    assets_path = Rails.root.join(asset_root, 'assets').to_path    return true if path.starts_with?(assets_path)  end  falseend# Precompile all assets under app/assets (unless they start with _)Rails.application.config.assets.precompile << proc do |name, path|  starts_with_underscore = name.split('/').last.starts_with?('_')  unless starts_with_underscore    path = Rails.application.assets.resolve(name).to_path unless path # Rails 4 passes path; Rails 3 doesn't    precompile?(path)  endend

(Based on the code in the Rails Guide.)