13

Going nuts here. I'm developing a rails app, and I'm using the twitter-bootstrap-rails gem in order to include the Twitter Bootstrap styles in my app. This gem generates a file called 'bootstrap_and_overrides.css.less' in app/assets/stylesheets, which I have been using to modify some of the bootstrap variables and include my own CSS overrides.

Everything has been working fine until today. For some reason, the changes I am making to this file today are getting saved to the file, but Rails is still serving the old version of the file! I've searched and found no precompiled versions of the file anywhere (nothing in public/assets)...only the one in assets/stylesheets which I have been modifying. Everything looks fine as far as the directories within the app go, but then when I start the rails server, load the page, and use the element inspector to look at the stylesheets, it's using an old version of 'bootstrap_and_overrides.css.less' with rules that I have deleted. I've turned of the cache in my browser, and tried it in 4 different browsers too, so I'm pretty sure this isn't a result of browser caching.

The rails asset pipeline just seems to serving a version of the file that doesn't exist! Does anybody have any ideas why this might be happening?

Andrew
  • 2,425
  • 2
  • 24
  • 35

1 Answers1

31

Fixed it.

The asset pipeline was storing a cached version in tmp/cache.

I ran rake tmp:clear, which deleted all the files in there, and then rails served the version of *bootstrap_and_overrides.css.less* that I wanted.

Why the cached version suddenly stopped getting updated is beyond me. Arrghhhh!

Pablo Marambio
  • 1,562
  • 1
  • 15
  • 29
Andrew
  • 2,425
  • 2
  • 24
  • 35
  • 3
    That fixed a gem bug I was having just like this! Thanks, I was completely unaware of that rake task. – Ode Jan 09 '13 at 21:01
  • 1
    Thanks. I had this same problem with bootstrap-sass. The gem had been update to run the latest version of bootstrap, but my rails app was still serving the old version. – Lee McAlilly Mar 20 '13 at 18:31
  • It looks like `rake tmp:cache:clear` works. Seems like there's probably an asset pipeline bug lurking here still though. – Alex Dixon Apr 28 '14 at 22:55
  • In addition I have to restart the server. – GuiGS Nov 06 '14 at 15:26
  • Freaking hell. I just spent a good hour messing around with this. I can't believe how sticky this cache is. I tried everything, including restarting the computer. Then finally ran the rake task, but forgot to restart my server. It was driving me bonkers. Then I finally remember to restart the server. The f'd up thing is that my editor (atom.io) does not load the /tmp folder, so I was going mad trying to figure out where the freak the file kept loading from! Thanks man. – vinhboy Jan 19 '15 at 23:26