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:
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 folderconfig.assets.compress = false
config.assets.debug = true
to see the traces of the css being loadedconfig.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
tmp/cache
folderTo 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...
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.
Delete your public/assets file and restart server and you will be up and running again and dont run assets:precompile again after
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With