I've been having real problems with browser cache clearing in a fusion subtheme.
Changes that I make in the subtheme local.css just aren't being picked up by Firefox or IE.
Drupal cache clear, browser cache clear, reboot, not behind proxy cache, multiple locations and all that jazz... just not picking up.
Anyway, I note that something may help this.
In @common.inc @drupal_get_css caching issues are somewhat mitigated by adding a query string to the end of each css file name like so:
$query_string = '?'. substr(variable_get('css_js_query_string', '0'), 0, 1);
That is not being done for fusion in @template.php in @fusion_core_preprocess_page(&$vars).
My suggestion is that you might consider adding a string just like core does.
So... at ~ line 98 in template.php
// Get query string like core
$query_string = '?'. substr(variable_get('css_js_query_string', '0'), 0, 1);
foreach ($themes as $name => $path) {
$link = '<link type="text/css" rel="stylesheet" media="all" href="' . base_path() . $path;
$vars['setting_styles'] .= (file_exists($path . $grid_style . '.css')) ? $link . $grid_style . '.css' . $query_string . '" />' . "\n" : '';
$vars['ie6_styles'] .= (file_exists($path . '/css/ie6-fixes.css')) ? $link . '/css/ie6-fixes.css' . $query_string . '" />' . "\n" : '';
$vars['ie7_styles'] .= (file_exists($path . '/css/ie7-fixes.css')) ? $link . '/css/ie7-fixes.css' . $query_string . '" />' . "\n" : '';
$vars['ie8_styles'] .= (file_exists($path . '/css/ie8-fixes.css')) ? $link . '/css/ie8-fixes.css' . $query_string . '" />' . "\n" : '';
$vars['local_styles'] .= (file_exists($path . '/css/local.css')) ? $link . '/css/local.css' . $query_string . '" />' . "\n" : '';
if (defined('LANGUAGE_RTL') && $language->direction == LANGUAGE_RTL) {
$vars['setting_styles'] .= (file_exists($path . $grid_style . '-rtl.css')) ? $link . $grid_style . '-rtl.css' . $query_string . '" />' . "\n" : '';
$vars['ie6_styles'] .= (file_exists($path . '/css/ie6-fixes-rtl.css')) ? $link . '/css/ie6-fixes-rtl.css' . $query_string . '" />' . "\n" : '';
$vars['ie7_styles'] .= (file_exists($path . '/css/ie7-fixes-rtl.css')) ? $link . '/css/ie7-fixes-rtl.css' . $query_string . '" />' . "\n" : '';
$vars['ie8_styles'] .= (file_exists($path . '/css/ie8-fixes-rtl.css')) ? $link . '/css/ie8-fixes-rtl.css' . $query_string . '" />' . "\n" : '';
$vars['local_styles'] .= (file_exists($path . '/css/local-rtl.css')) ? $link . '/css/local-rtl.css' . $query_string . '" />' . "\n" : '';
}
}
Comments
Comment #1
sethviebrock commentedSame issue. Sometimes a CSS edit will not show up for a minute or so, even after clearing all Drupal caches, with the theme registry being rebuilt on each page load, no CSS aggregation, no caching, nothing. I tried putting the above solution in my subtheme's preprocess_page function to no avail.
Comment #2
hongpong commentedsubscribe
Comment #3
ezra-g commentedWhile I wasn't able to reproduce the symptom in Firefox 3.6.15 on OS X 10.6.6, the solution proposed here sounds reasonable, since it follows the behavior of Drupal core.
When *not* aggregating, change the query string on each css file when the cache is cleared.
Since these stylesheets specifically avoid aggregation, we add the query string to them following the approach used in common.inc.
Here it is as a patch for review.
Comment #4
coltranegrids.css was missing the query string. I also couldn't replicate but think the method is sound. @willieseabrook, @sviebrock or @HongPong can you test this?
Comment #5
giorgoskit works as expected
I only had to erase
the last 3 lines from the last patch
as my netbeans IDE would not apply the patch ???
otherwise its the same patch as above
Comment #6
aquariumtap commentedlooks good. patch committed!
Comment #7
js commentedThis is really great. Thanks. I can stop counts restarts of varnish as well as other attempts to flush the various cache.
Comment #8
bkosborneGlad to have this in here as well!