Rails not compiling stylesheets in development after assets were precompiled

asset-pipeline, css, ruby-on-rails-4, stylesheet

Solution

Precompiled assets will supersede the uncompiled ones. The documented way to clear them is `bundle exec rake assets:clobber`. In Rails 3, all this does is delete the `assets` folder. Perhaps in Rails 4 it's more extensive (I don't have an installation here to test). Give it a try.

Note if you used an environment qualifier like:

RAILS_ENV=production bundle exec rake assets:precompile

to precompile, use the same qualifier to clobber.

However, the other thing that can defeat you is browser caching. Clear everything from the browser cache. Ideally try a completely different browser. I wasted a day figuring out that Safari requires selection of Safari | Reset... to purge everything.

Problem

I ran the command `rake assets:precompile` in my console, then my stylesheets stopped being compiled in my application.css file when I go to localhost:3000... Before, everything was perfect on development mode : write a stylesheet, require it in the application.css file, then see the styles being displayed in my view. So the asset pipeline "used to" work. What I did to try to make it work (and failed) using other answers on SOF: - In config/application.rb I added `config.assets.enabled = true` in config/development.rb I added the following : - `config.serve_static_assets = false` so that Rails doesnt look for my stylesheet in the public/assets folder - `config.assets.compress = false` - `config.assets.debug = true` to see the traces of the css being loaded - `config.assets.compile = true` I deleted the `public/assets` folder which got created after I ran `rake assets:precompile` - another way of deleting the folders is to run the command `bundle exec rake assets:clobber` but this didn't solve the problem - I delete the `tmp/cache` folder - restarted my server and cleared the browser cache everytime I was trying the sequence 1 thru 4 - tried changing the order in which I require my stylesheets in application.css To no avail... I also have the following setup application.html.erb `<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>` application.css *= require self *= require_tree . *= require custom *= require sidebar *= require flags/basic *= require flags/flags16 *= require flags/flags32 *= require font-awesome.min In application.css in the browser I see this : How come my `rake assets:precompile` could break my asset pipeline in development mode ? Thanks in advance for your help, I have spent at least 5 hours trying to figure this out and believed I have done everything I could to figure out a solution...

Original source