1

I'm building Drupal 7 website. I have main stylesheet which is on the path: sites/all/themes/MYSITE/css/main.css.

I created a custom page on the way that I first created a custom content type and after that page--custom-page.tpl.php.

In the page--custom-page.tpl.php I inserted my html code and also corresponding css code.

Problem which I have is that main.css make a conflict in my custom page. I tried on a different ways to disable it but unfortunately without success.

I tried with this:

$arrCSS = drupal_add_css();
echo '<pre>';
print_r($arrCSS);
unset($arrCSS['all']['will']['sites/all/themes/will/css/main.css']);

Output which I got with print_r($arrCSS) is:

   [sites/all/themes/will/css/main.css] => Array
    (
        [group] => 100
        [every_page] => 1
        [media] => all
        [type] => file
        [weight] => 0.003
        [preprocess] => 1
        [data] => sites/all/themes/MYSITE/css/main.css
        [browsers] => Array
            (
                [IE] => 1
                [!IE] => 1
            )

    )

Every kind of help is welcome. Thanks in advance.

user2834820
  • 13
  • 1
  • 7
  • Have you tried this: http://stackoverflow.com/questions/14121231/remove-stylesheet-selectively-in-drupal-for-page Hope that helps. – magicRoot Nov 01 '13 at 22:45

1 Answers1

1

To unset a CSS file, you should use the HOOK_css_alter hook available within Drupal.

Assuming your theme is named will

function will_css_alter(&$css)
{
    if () { //Unset CSS file if the current page is your custom page
        $path = drupal_get_path('theme', 'will');
        unset($css[$path . '/css/main.css']);
    }
}
Mike Vranckx
  • 5,557
  • 3
  • 25
  • 28