Lines out of place:
* 'inline': A string of CSS that should be placed in the given scope. Note that it is better practice to use 'file' stylesheets, rather than 'inline' as the CSS would then be aggregated and cached.
* 'external': The absolute path to an external CSS file that is not hosted on the local server. These files will not be aggregated if CSS aggregation is enabled.
should be after 'file' into $data in Parameters section.
Available constants are:
* CSS_SYSTEM: Any system-layer CSS.
* CSS_DEFAULT: Any module-layer CSS.
* CSS_THEME: Any theme-layer CSS.
If you need to embed a CSS file before any other module's stylesheets, for example, you would use CSS_DEFAULT - 1. Note that inline CSS is simply appended to the end of the specified scope (region), so they always come last.
* 'media': The media type for the stylesheet, e.g., all, print, screen. Defaults to 'all'.
* 'preprocess': Allows the CSS to be aggregated and compressed if the Optimize CSS feature has been turned on under the performance section. Defaults to TRUE.
What does this actually mean? CSS preprocessing is the process of aggregating a bunch of separate CSS files into one file that is then compressed by removing all extraneous white space. Note that preprocessed inline stylesheets will not be aggregated into this single file, instead it will just be compressed when being output on the page. External stylesheets will not be aggregated.
The reason for merging the CSS files is outlined quite thoroughly here: http://www.die.net/musings/page_load_time/ "Load fewer external objects. Due to request overhead, one bigger file just loads faster than two smaller ones half its size."
However, you should *not* preprocess every file as this can lead to redundant caches. You should set $preprocess = FALSE when your styles are only used rarely on the site. This could be a special admin page, the homepage, or a handful of pages that does not represent the majority of the pages on your site.
Typical candidates for caching are for example styles for nodes across the site, or used in the theme.
should be after 'weight' into $options in Parameters section.
Comments
Comment #1
jhodgdonGood catch!
This is caused by blank lines in the documentation header, within a @param section:
And as a note, the doc is in includes/common.inc -- and the Drupal 6 version of the doc has the same problem.
Comment #2
jhodgdonHere's a patch for the drupal_add_css() doc. It cleans up the blank line issues (which should make the doc for particular parameters go in the right places), and there is also some general writing style and clarification cleanup.
Comment #3
jhodgdonComment #5
dries commentedCommitted to CVS HEAD. Thanks!
Comment #6
sun@jhodgdon: I love you.