Rails using cached application.css despite changes Rails using cached application.css despite changes ruby-on-rails ruby-on-rails

Rails using cached application.css despite changes


I had the same issue. I stopped the server, executed rm -fr tmp/cache, and my css files were finally rebuild.


First, the usual cache clearing sanity checks might help. Clear browser cache. Clear server file cache (if you're in dev/test or can afford to in production) and sass-cache :

rake tmp:cache:clearrm -fr tmp/sass-cache #or 'compass clean' if using compass

If that doesn't help, maybe Rails compiled ANOTHER application.css elsewhere (that didn't get removed by the cache clearing)?

For example, I ran compass watch app/assets/stylesheets/application.css.scss for debugging purposes and it created a public/assets/application.css file which, by virtue of it's location in public/, prevented any new application.css.scss stylesheet changes from being noticed by Rails. Once I removed it, the application again pulled from the .scss stylesheets. This is just one example of accidental overriding file creation. Try running a find on the entire application directory looking for any generated application.css files, doing this after the cache clearing to avoid those showing up in your results.

(FYI, to avoid my specific issue, I now run compass watch with --css-dir pointed at the cache to prevent my issue

$ compass watch app/assets/stylesheets/application.css.scss  --css-dir tmp/cache/

)


I've had a similiar issue after running rake assets:precompile in development. Maybe Rails is serving precompiled assets from public/assets? Try cleaning that up.

You shouldn't need to touch aplication.css.scss in development, rails should serve the new content whenever one of the @included files changes.

Also, make sure you have the following in config/environments/development.rb

# Do not compress assetsconfig.assets.compress = false# Expands the lines which load the assetsconfig.assets.debug = true