Question

My application works locally, but the stylesheets are not working on Heroku. I'm having difficulty understanding why.

I'm using Heroku's Cedar stack.

One of my ideas, is that my assets are not precompiling successfully:

RAILS_ENV=production bundle exec rake assets:precompile

rake aborted!
Invalid CSS after "*/": expected "}", was ""
  (in /path/to/app/assets/stylesheets/application.css)

Can anyone explain why precompile is complaining about the */ on the very last line of application.css? It's meant to be there. If anyone has a fix, that would be ideal as well.

application.css

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 *= require reset
 *= require style
 *= require projects
 *= require_self
*/

Update I attempted to add quotes in my application.css, and it doesn't make a difference. Something isn't setting right I guess. But I'm unable to precompile to send to heroku. When I load the site, there is rarely any formatting at all.

Was it helpful?

Solution

First up, how come you're using Rails 3.1rc5? - that came out almost 6 months ago, can you not up it to 3.1.3 which is the latest release? You could be fighting bugs (and certainly Rails security fixes) which have since been fixed and certainly using updated dependent gems.

Your syntax is exactly right for the manifest files (see http://guides.rubyonrails.org/asset_pipeline.html) - The problem may also lie in the files you are requiring, so the error may be being misreported. You could try a process of elimination by removing some or the require statements trying a precompile and seeing if it's successful or not, then readding them to find the troublesome file?

OTHER TIPS

I'm pretty sure you need to quote your files:

*= require 'reset'
*= require 'style'
*= require 'projects'
*= require_self
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top