Hi,
I have a long-standing problem with Fusion-based sub-themes, including unmodified packages like 'Acquia Slate' and own sub-themes, but I don't know to what degree Fusion is actually involved since I don't have any similar complex themes to compare; however, with an unmodified 'Garland' I don't encounter this issue; also, with other base themes like 'Zen' or 'Adaptivetheme' I never experienced this, but I havn't used them so intensively like 'Fusion'. Probably other JS-heavy modules (like Panels) or even Drupal core might be involved; and this has definitely something to do with caching and JS aggregation. I suspect Fusion because Fusion does some CSS related preprocessing in template.php (./sites/all/themes/fusion/fusion_core/template.php) I don't fully understand.
The problem: After clearing the Drupal caches (e.g. via 'admin_menu' or 'drush cc'), I get an unstyled display of the website (pretty much like this: example from advagg). The affected page has a reference to the CSS stylesheet and JS file, e.g.:
<link type="text/css" rel="stylesheet" media="all" href="/sites/default/files/css/css_b38e1e19abb231a3c8740b56fd4db339.css" />
If I inspect this in Firebug/Dragonfly, the referenced files like ./sites/default/files/css/css_b38e1e19abb231a3c8740b56fd4db339.css or ./sites/default/files/js/js_3e70254cea4393260c64191e6f37606e.jsmin.js does not exist; probably they were purged by clearing the caches, and for whatever reason the aggregated files seem not to be regenerated, or the references are not being refreshed. The ugly thing with this is that I have no idea to fix this since clearing the caches causes the problem. I believe the issue disappears after a while, but I don't know when and how. I watched an affected site for a couple of hours, and the broken references to the CSS and JS files were still there. On sites where I use boost, it helps to completely wipe the static 'boost' cache. Obviously this is not a really viable option, and the issue also occurs on sites without boost.
The behaviour affects anonymous user, but not user #1 or other logged-in users. What makes this a real pain in the a** is that the issue is not 100% reproducable. E.g. I had this for months on a site with 'Acquia Slate', but for some reason it suddenly disappeared when I just checked. It usually occurs on the frontpage and not on sub-pages; my front pages are usually made with Panels, but other Panels pages are not necessarily affected (in the Panels queue is a long-standing and obscure issue with panels pages as Drupal frontpages). Or it simply only the first page loaded after clearing the caches is affected, I'm not sure. However, in most cases I can reproduce the problem on the front page.
Except for Drupal core's caching mechanisms, other modules that might be involved include panels, jQuery Update, jQuery UI, css_gzip, javascript_aggregator, boost, and probably even more.
I'm posting this as a support request to find out if this is a known issue, or if this only affects a special type of setup I'm using on all my sites. When digging in the issue queues of the mentioned modules, I stumbled over a whole hornet's nest of somehow related issues that are vastely beyond my understanding.
For example there is #1150150: AdvAgg - Fusion Core theme - Lost local.css? and #1154732: AdvAgg Integration with a Fusion-related issue that affects the 'Advanced CSS/JS Aggregation' module; most bizarrely, this module claims to solve issues with broken references to CSS/JS files that come with CSS/JS aggregation: "...getting a 404 for a CSS or JS file is now almost impossible".
Anyway, I'd love to get any pointers how to resolve this. Please feel free to change the issue queue if you know a more appropriate one.
Thank you!
Comments
Comment #1
aquariumtap commentedTry running both your CSS and JS (unaggregated) through some validation service to check for any typos or syntax errors.
I've experienced a very similar issue before, but not on a Fusion site. It wasn't 100% reproducible, we were running Drupal 6.x, anon users were affected but admin was not. Something was clearly breaking during aggregation, but I couldn't find any problems with out of memory errors, caching, permissions, CSS, etc. One day we discovered a small JS error, fixed it, and the disappearing CSS issue never returned. That didn't give us a clear picture of the mechanics of the bug, but it's never creeped back up.
Comment #2
stephthegeek commentedI just wanted to add that I also ran into something that sounds very similar a couple of years ago. People would occasionally report that our site had no styles, but I would only sometimes be able to replicate it.
It turned out to be related to compression and the file types specified in mod_expires. I wish I could be more specific but it was a long time ago :\
Comment #3
asb commentedAs I was afraid, sounds like this will be very hard to track down by a systematic approach, and practically impossible to resolve. Especially since this occurs on production sites.
Regarding JS and Fusion, there are definitely issues with Panels respectively Ctools modal dialogues; I have them and others have them too, but I don't know if there is even a connection with this issue.
@aquariumtap: Yes, probably similar issues will probably show up with every "modern" or "advanced" theme with lots of JS. If you know a JS validator, I'm all ears. Jslint seems to work only locally, and www.javascriptlint.com accept an URL as input, but has a limit of 128k.
@stephthegeek: Yes, maybe even the webserver/Apache layer might be involved, or PHP with APC caching, or Memacache. Doesn't make the debugging easier :(
For now, I replaced 'css_gzip' and 'javascript_aggregator' with 'Advanced CSS/JS Aggregation'. That changed the behaviour somehow, but introduced a number of weird new issues (e.g. some links in Views pages/blocks are no longer clickable; Views Slideshow doesn't change slides, etc.; however, this is probably totally unrelated to Fusion).
With AdvAgg, the broken references to CSS/JS files occur significantly less frequent after 'drush cc (all)'. However, some page layouts with Panels and Skinr styles break for some time (columns not side by side, but 2nd column after 1st column. For whatever reason this seems to fix itself after some minutes. That's not really grat, but a lot better; if there wasn't the other issues with AdvAgg ;)
Comment #4
mikeytown2 commentedComment #5
mikeytown2 commented@asb
Are you using something like HeadJS or LABjs?
Comment #6
asb commented@mikeytown2: No, so far not. Should I?
Comment #7
mikeytown2 commentedDo not use. LABjs + Panels + ctools + wysiwyg = odd js behavior. For me though I've gotten Panels + ctools + wysiwyg to work fine on a zen theme. The only thing that is different between my setup and yours is the theme from what I can tell.
Comment #8
asb commentedYes, Zen is way more tame than Fusion. However, Advagg is a real improvement compared to the combo 'css_gzip' plus 'javascript_aggregator'. For example, a couple of days I've seen the first time certain Panels fieldy as resizable that before always crashed with Fusion and aggregation. Also the missing aggregated JS files happen significantly less often with Advagg after cleaing the caches, if at all.
Comment #9
Poieo commentedComment #10
loopy1492 commentedI had something similar happen to me recently. I had a duplicate backup folder of my theme in my site. Even though the folder had a different name, the .info was the same and everything. This caused the site to switch between the two themes of the same name. Oddly, this didn't occur in our Dev and Stage environments; only production, so it took us a while to figure out what was going on.