Quantcast
Channel: WhizCreed
Viewing all articles
Browse latest Browse all 14

Drupal 7 – unable to include css file as standalone file using drupal_add_css

$
0
0

I struggled quite a bit on this, unlike js files where you can add an alert or log a message to the log, which would indicate that the script is loaded on the page. I wanted the css file to be included as a stand alone include rather than comobined with other files.

After going through the drupal_add_css documentation I found a solution to my problem:

drupal_add_css(drupal_get_path(‘module’, ‘xyz’) . ‘/styles/css/style.css’,
array(‘preprocess’ => false));

The key here is to pass the preprocess option parameter as false, which is true by default and if you have aggregation enabled in your drupal project, then your css files are compiled into a single one!!


Viewing all articles
Browse latest Browse all 14

Trending Articles