Turning cache on breaks the theme in firefox, in Safari it works but not in firefox, I can't figure it out. Why would it work when it's turned off but not when it's turned on ?

Comments

darumaki’s picture

I also confirmed this with a fresh download of Deco and still same,

Manuel Garcia’s picture

It seems to break when css agregation is turned on, not all of it but enough to make me turn it off.

darumaki’s picture

yes, that's what I meant css aggregation,

update I think I found the problem, css aggregator doesn't take too kindly to the @CHARSET "UTF-8"; at the top of the file and also the @import css. When removing these, everything went ok with theme.

solution found here http://drupal.org/node/122938

Olarin’s picture

we've been getting some problems too, with our own modified version of deco.

http://drupal.org/node/168620 has a patch that was committed to core last year which should have resolved the charset problem in css caching, so the problem is more likely with the @import calls, yes? or am i missing something?

Olarin’s picture

hm, @import calls should also already be fixed - in the patch from http://drupal.org/node/113607

Olarin’s picture

To (attempt to) clarify what I said above:

darumaki links to a thread that mentions two problems the zen theme ran into with css caching:

- css files with "@CHARSET" don't work right under css aggregation
- css aggregation moves "@import" calls from all files to the top of the cache, also breaking the theme

darumaki said that removing @charset and @import lines from the theme fixes the problem in their installation. However, the @charset problem should have already been dealt with according to the first link I posted (css aggregation now omits @charset calls when aggregating), and the @import problem should have already been dealt with according to the second link I posted (css aggregation now recursively replaces @import calls with the css files imported rather than just moving the import calls), so neither of these things SHOULD be a problem any more, so this seems very odd. I haven't had a chance to test whether removing those lines in our installation solves the problem for us.

darumaki’s picture

I can assure you, the problem still exists, I had to remove them from the CSS file and that fixed it.

Olarin’s picture

I'm not doubting you, I'm just saying it suggests the possibility that something is seriously wrong in core - perhaps some sort of browser-specific handling that negates the original fixes I linked to?

Olarin’s picture

Ok, I had a chance to test on our site and I've narrowed down the problem.

darumaki was right, or at least half right. The @CHARSET calls are not causing any trouble, but the @import calls certainly are. The correct fix (for now) is not just to remove them, but to replace them with the code they are trying to import. The only two @import calls in the deco theme are in style.css, to bring in layout.css and icons.css.

Now the question is *why* these @import calls cause trouble in Firefox, because we shouldn't have to lump all the code for deco into one giant css file like that. In fact, the css aggregator is supposed to automatically resolve the @import calls in exactly this manner for us when it generates the cached css file. We may want to re-open the relevant issue (http://drupal.org/node/113607) or create a new one, as best I can tell this is a problem with drupal core, not with deco.

darumaki’s picture

The correct fix (for now) is not just to remove them, but to replace them with the code they are trying to import. The only two @import calls in the deco theme are in style.css, to bring in layout.css and icons.css.

What do you mean by replace with code they are trying to import, can you give an example ?

Olarin’s picture

For the call @import "layout.css" in style.css: comment it out (or delete it), then copy the entire contents of the layout.css file, and paste them into the style.css file at the point where the import call was.

Same thing for the @import "icons.css" call right after it - paste in the entire contents of the icons.css file.

If you just remove the @import calls without pasting in the relevant code, you should notice your theme breaking even worse (for instance without the code of layout.css you won't have any sidebars).

Olarin’s picture

I just posted a Drupal issue about this problem: http://drupal.org/node/317059 Hopefully someone knowledgeable can give us an explanation and/or a solution.

Manuel Garcia’s picture

thanks for that Olarin, let's cross our fingers.

darumaki’s picture

What I did was add the layout and icon stylesheet to the info file, it's not really a good idea to load one stylesheet with everything. A .css file should be no larger than 6-12 kb.

Olarin’s picture

Could you show exactly how to do that darumaki?

darumaki’s picture

edit the .info file

add these
stylesheets[all][] = css/layout.css <--
stylesheets[all][] = css/icons.css <--
stylesheets[all][] = css/style.css

remember to remove them from the style.css

Olarin’s picture

Category: support » bug

Thanks. That fix works fine for me, and is certainly much better than my original hack solution.

In the drupal issue I posted, http://drupal.org/node/317059, I basically received a response of "themes shouldn't use @import calls", and the same solution that darumaki posted here. In light of that, I'm changing this to a bug report; is there any reason darumaki's fix shouldn't just be committed as a permanent solution?

c31ck’s picture

Status: Active » Fixed

Fixed in 6.x-1.x-dev by http://drupal.org/commitlog/commit/3850/a4bf5ce7d693a7cf8af635633370dcbb...
Thank you all for your efforts.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.