I am in the process of optimizing my Drupal site by removing unnecessary css files.

Running an audit I have found that /misc/ui/jquery.ui.core.css, /misc/ui/jquery.ui.theme.css and /misc/ui/jquery.ui.slider.css are relatively large but are never called.

I have tried removing them in my template.php file with the following but they still remain. How can I unset them?


2 Answers 2


You can use hook_ccs_alter

function yourmodule_css_alter(&$css) {


An alternative way in Drupal 7 using YOUR_THEME_css_alter() is

    function YOUR_THEME_css_alter(&$css) {
    // Remove Drupal core css 
        $exclude = array( //confirm path
            'misc/ui/jquery.ui.slider.css' => FALSE,
            'misc/ui/jquery.ui.core.css' => FALSE,
            'misc/ui/jquery.ui.theme.css' => FALSE,
            // Also you can remove contrib module CSS 
            drupal_get_path('module', 'views') . '/css/views.css' => FALSE,);
        $css = array_diff_key($css, $exclude);

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.