Adding Module Stylesheets using drupal_add_css()
A couple days ago, when building a quick site with limited functionality (basically a pretty front end to a database website), I ran into a hiccup with my custom module/theme for the site, which caused me to scratch my head for a few minutes.
In my custom module (called 'idcards'), I added a stylesheet for a couple forms on the site using the drupal_add_css()
function:
/** * Implementation of drupal_add_css() */ drupal_add_css(drupal_get_path('module', 'idcards') .'/idcards.css');
Later on in the development, I added a custom theme (based off a Zen subtheme I use for many smaller sites), and in that custom theme's .info file, I added a stylesheet named idcards.css.
When I cleared all the caches, I noticed the custom form styling (added by the module's idcards.css file) was missing, and on further investigation, I found that the module's idcards.css file was not being added to the pages!