I created a sub theme which add's a Dev option to temporary disable Drupal's CacheBuster query strings after the stylesheet file name (style.css?XYZ). This is useful for live styling with Espresso or CSSEdit for Mac using their great @override feature.

Mabe it could be included in Zentropy core.


  $form['zentropy_settings']['zentropy_dev']['zentropy_cachebuster_css'] = array(
    '#type' => 'select',
    '#title' => t('CachBuster CSS query strings'),
    '#description' => t('During theme styling with CSSEdit’s or Espresso’s @override feature, it can be very useful to disable the CacheBuster CSS query strings. (style.css?XYZ)'),
    '#default_value' => theme_get_setting('zentropy_cachebuster_css'),
    '#options' => array(
      '' => t('Add query strings (Drupal default)'),
      'all' => t('Always remove query strings'),
      'onlyadmin' => t('Remove query strings for logged in admins only'),


* Implements template_process_html().

// Remove Query Strings from CSS filenames (CacheBuster)
function zentropy_process_html(&$variables) {
  global $user, $conf;
  if (theme_get_setting('zentropy_cachebuster_css')) {
    if (theme_get_setting('zentropy_cachebuster_css') == 'all' || (in_array("administrator",$user->roles) && @$conf['site_offline'] == 0 && !stristr($_GET['q'],'flush-cache'))) {
      $variables['styles'] = preg_replace('/\.css\?.*"/','.css"', $variables['styles']);


alexweber’s picture

Awesome! Absolutely!

Would you mind creating a patch against 7.x-2.0-dev?

I would happily review and commit it, giving you author credits! :)

Wolfgang Reszel’s picture

new2.18 KB

Okay. I try. I never created a patch before. I hope it works.

alexweber’s picture

Status:Active» Needs review

Patch applied cleanly, commited in 457ded5.

Thanks! :)

alexweber’s picture

Wolfgang, I've been thinking about this and I love the feature but I don't see why we need to have the option to enable it for admins only. Since this is a development-only feature we assume that performance doesn't matter, I'm going to change this to either on or off.


Wolfgang Reszel’s picture

Well, my Drupal projects are often vital projects where I sometimes adjust or enhance the styling on the page which is already online. I don't want the visitors or editors would be forced to reload the stylesheets. So I just have to login as admin for styling without affecting other users and its also faster than enabling this option every time I need it. Previously I had this always hardcoded in my templates and as I decided to always use Zentropy as my base for future projects I thought it would be cool to be optional. Sometimes I need styling when not logged in, so a simple on-off does not fit my needs.

alexweber’s picture

Wolfgang, I understand and will take this into consideration!

PS - The commit is looking nice in your profile page! ;)

alexweber’s picture

Status:Needs review» Closed (fixed)

@Wolfgang, I gave this some thought and re-enabled the "admin only" option. Commited in dev, release coming later on tonight! :)

doublejosh’s picture

This is a nice general solution as well.

function MYTHEME_process_html(&$vars) {
  if (variable_get('environment') == 'development' && !stristr($_GET['q'],'flush-cache')) {
    $vars['styles'] = preg_replace('/\.css\?.*"/','.css"', $vars['styles']);

As long as you place these in your settings.local.php files...
$conf['environment'] = 'development';
$conf['environment'] = 'production';

doublejosh’s picture

Issue summary:View changes