1

Is it possible to remove the module/system/default.css file. I'd like to do this in the .module file and not in the template.php file.

My goal is to disable this style in my drupal website without manipulating a template/theme.

Is it possible?

Thanks in advance,

Bat

1 Answer 1

5

This is possible. You can use template_preprocess_page in your custom module to whack Drupal's default CSS:

function mymodule_preprocess_page(&$vars) {
  // Get CSS array and remove selected stylesheets
  $css = drupal_add_css(); 
  unset($css['all']['module']['modules/system/defaults.css']);

  // Override Drupal styles
  $vars['styles'] = drupal_get_css($css);
}

Because of Drupal's architecture, you'll almost certainly need to set the module weight to something greater than your other installed modules to ensure that your preprocessor runs last and no other module will be adding CSS.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.