Sign up ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am trying to add a file which is located in sites/default/files/color/theme-768/color.css using drupal_add_css().

I have tried drupal_add_css($filepath), but it doesn't work. I tried putting it in template.php and hook_init(), but still it isn't included in the style tags of head section or anywhere.

How I do include a CSS file like this using drupal_add_css()?

share|improve this question
    
This is the same question you already asked. If you have more information to add to a question, please edit it. Asking the same question more than once causes the new questions to be closed as duplicates. –  kiamlaluno Jul 27 '13 at 8:02
    
@Ram I'm also struggling with the same issue for a week, I dynamically created css using color module and couldnt figure out how to include it. –  pown Jul 27 '13 at 8:02
    
@kiamlaluno: have deleted that question now, since its not been properly constructed or properly asked. can any one help with this.Now its not duplicate i think. –  Ram Jul 27 '13 at 8:08
    
Since it didn't have any answer, you could have edited the old question. –  kiamlaluno Jul 27 '13 at 8:10
    
I thought i kind of twisted that question, so tat only.Any suggestions regarding this one :) –  Ram Jul 27 '13 at 8:12

1 Answer 1

up vote 0 down vote accepted

I found a alternate way to include css file which is in some other location other than modules and themes.In my case including a dynamically generated file. Even though i can't find a way through drupal_add_css(),this helped me in adding css.

This is the way i included dynamically generated css file which is located at sites/default/files/color/theme-768/color.css

In the theme folder in the html.tpl.php after <?php print $styles;?> include this

<?php    
       print '<style>';
       print '@import url("' . $filepath . '")';
       print '</style>';
?>

This includes the css file.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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