2

After using Bootstrap for a while I wanted to give Zurb Foundation a spin today. I like the grid system and various other elements of Zurb a lot better.

But I noticed refresh times on my (nearly empty) development app were very slow. When I checked the logs I saw dozens of lines like the following:

Warning. Error encountered while saving cache 6552595674261f5b11715c13321f2419e14e57a4/_global.scssc: can't dump anonymous class #<Class:0x0000000562f8e0>

They appear any time I make any change to my own (very basic) application.scss file.

@import "foundation_and_overrides";

#container {
  background: #eee;
}

This is the only css I have in the project so far. The (relevant) gems in my project are:

foundation-rails (5.2.0.0)
sass (3.3.0)
sass-rails (4.0.1)

The sass gems were installed automatically as dependencies by Zurb.

This is all on my local development machine, using thin as a server. No Heroku or anything like that. Tried changing the local cache from file_store to memory_store, just in case, but it makes no difference.

Otherwise it's functioning fine, the css is rendered as expected, it's just painfully slow on each refresh because the cache is failing. Any thoughts would be greatly appreciated.

Peter Duijnstee
  • 3,759
  • 2
  • 20
  • 30
  • Possible duplicate of [Heroku: Error encountered while saving cache](http://stackoverflow.com/q/22276991/456814). –  May 21 '14 at 05:28

2 Answers2

3

Hmm, seems to be a bug in sprockets, as you can see in the following issue: https://github.com/nex3/sass/issues/1144. Disabling config.cache_store in your development.rb file will solve the error, but is -of course- not the solution to your problem.

rails4guides.com
  • 1,441
  • 2
  • 11
  • 8
  • Disabling the line altogether just makes the application default to the file_store, so that didn't really change anything. I figured maybe changing it to null_store might prevent it from caching altogether but that doesn't work either, it still tries to dump the classes anyway (the null cache just drops whatever gets put into it I think.) And, as you say, it wouldn't really help in any case because the results wouldn't get cached. Despite the errors it seems like the css does end up getting cached, as subsequent requests (if I don't change the css) are quite fast. – Peter Duijnstee Mar 09 '14 at 14:53
  • Hmm read the issue report you mentioned and followed a few links, it doesn't look like anyone on the Sprockets team has picked up on it yet after 3 months. Someone mentioned a temporary fix at https://github.com/LRDesign/sass-rails-source-maps but it doesn't seem to work, at least for me. Sadly I don't have time to dig into the Sprockets internals right now so I guess it's back to Bootstrap for the time being which seems to avoid this bug. – Peter Duijnstee Mar 09 '14 at 15:11
  • It's an issue for a few months already now, seems like it's not their highest priority. It does answer your question why it is not working though, so I would appreciate if you accept the answer although it was probably not what you wanted to hear. – rails4guides.com Mar 10 '14 at 06:44
  • I wanted to give it a day, see if something else came up but I think you're right. Oh well :) – Peter Duijnstee Mar 10 '14 at 11:32
1

I think the answer to this SO question Heroku: Error encountered while saving cache may apply.

Basically, downgrade to sass 3.2.13 and the problem may just disappear for you, as it did for me.

(Oh, and you can switch back to Zurb Foundation, maybe ;-))

Community
  • 1
  • 1
Jon Kern
  • 3,186
  • 32
  • 34
  • Hah thanks for the tip, I'll have a look at it next time I have some free time :) – Peter Duijnstee Mar 25 '14 at 14:39
  • Yes... Adding gem 'sass', '3.2.19' solved it for me. Followed with a bundle update sass. It has something to do with sass 3.3.x. Using Zurb 5.3.3.0 and Rails 4. – blnc Aug 12 '14 at 21:28