I'm a bit confused as it seems like the application.css is including itself twice, once when it lists the resources from the manifest and then a cache of that. So when I delete an individual file it still seems to stay alive inside the application.css file.
application.css (source)
/*
*= require twitter/bootstrap
*= require_self
*= require_tree ./common
*= require_tree ./helpers
*/
Which works as expected and outputs in dev mode all the relevant individual files
development.rb
# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true
output
<link href="/assets/twitter/bootstrap.css?body=1" media="screen" rel="stylesheet" type="text/css" />
<link href="/assets/application.css?body=1" media="screen" rel="stylesheet" type="text/css" />
<link href="/assets/common/announcement.css?body=1" media="screen" rel="stylesheet" type="text/css" />
<link href="/assets/common/button.css?body=1" media="screen" rel="stylesheet" type="text/css" />
<Blah blah>
application.css (output)
This should be blank? Since all I have in my application.css file is the manifest and no actual css but instead i get all my concatenated code 106kb long.
IE if I remove a file in the common directory, it doesn't go away. It is no longer listed in the output but the css still appears from the application.css
The thing that worked for us was setting 'config.assets.debug = false'
This no longer set the HTML included CSS as href="/assets/bootstrap-new.css?body=1", instead set it up as href="/assets/bootstrap-new.css", which I think was the issue.
There was one last step required for me, but I got it fixed. Here's what I did:
Then, I refreshed my screen in Google Chrome, and IT STILL DID NOT WORK. So, I launched Firefox and voila, it was actually working. This means that Chrome was caching the old files within the browser. So, I then cleared out the browser cache in Chrome, and it worked!
@Agustin's solution does it for me but here are a few things you need to do:
Delete everything in /tmp/cache/assets
Add
config.serve_static_assets = false
to development.rb or test.rb (credits to @Agustin)Restart your server.
Make sure your application.js / .css is not cached in your browser. Go to
http://localhost:3000/assets/application.js?body=1
and hit ctrl+f5 to force refresh (you can also try appending appending a randomizer param at the end:http://localhost:3000/assets/application.js?body=1&rnd=12343
If you get something else and ctrl+f5 still hasn't helped, you need to clear your browser's cache.Skipping either of these steps returned a cached application.js / .css conflicting with my updates in single files.
I had the same problem. Despite clearing tmp/cache and public/assets the minified application.css was still cached and served up from somewhere and my changes to individual css files were not getting served.
This worked for me: in application.css remove the line
*= require_self
restart server
that seems to remove the cache and if you click on application.css in your browser source you will no longer see the minified version
replace the
*= require_self
back into the file and continue developing.The assets do their job better when running the app in production environment then you'll have loading only the application.css with all the files included, and compressed, there to reduce the server request and this application.css with the compressed styles will be cached.
http://guides.rubyonrails.org/asset_pipeline.html
I know this is an old question, but one fix that worked for me is that I had nginx proxying to my development environment and it had a
location ~ ^/(assets)/
block in the configuration. Either comment it out, or try restarting nginx to invalidate the cache. If you're developing, you'll likely just want to comment it out entirely.I lost way too much time troubleshooting this until I remembered that.