I have a Rails 3.1 application that uses SASS. The application.css.scss
file looks like:
@import \'reset.css\';
@import \'960.css\';
@import \'p
I had the same issue. I stopped the server, executed rm -fr tmp/cache
, and my css files were finally rebuild.
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 assets
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true
You can invoke Rails automagic cache busting by doing the following:
_master.css.scss
@import 'pages/master';
Now you can make changes in master and have them reflected without messing with the cache manually.
(Note: I'm on Rails 4.2)
To wipe out the asset pipeline cache, a brute force rm -rf tmp/* will suffice. This has certainly fixed a few otherwise inexplicable CSS and JavaScript glitches in my experience. As a preventative measure, it might also be a good idea to clear the cache after upgrading gems or changing the asset pipeline configuration, although this may just be superstition.
Finally, if you are experimenting with rake assets:precompile in your development environment (more on this in a later article), you’ll also want to rm -rf public/assets/* afterwards to clean that up.
http://blog.55minutes.com/2012/02/untangling-the-rails-asset-pipeline-part-1-caches-and-compass/
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:clear
rm -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/
)
If you replace @import 'file.css';
with @import 'file';
in your application.scss
that should allow it to be auto-refreshed in development mode
I had been using bin/rails tmp:clear
until I removed the file extension