Drupal often add a lot of CSS and JS files to a page request. The added weight and number of HTTP requests is bad for performance. This can be partly fixed by the CSS and JS aggregation feature in Drupal (also see Aggregate cache). But you still have a slight weight problem to those aggregated files.

One solution is to avoid including unnecessary files in the first place. This module makes it easier for themes to specify what CSS and JS files to blacklist or whitelist. This is done from the themes .info file.


What one often ends up with is a whitelist of CSS files and a blacklist of JS files. Consider the following example:

blacklist[scripts][] = "*/panels/js/panels.js"

whitelist[stylesheets][] = "*/system/system.base.css"
whitelist[stylesheets][] = "*/system/system.messages.css"

The setup above will blacklist panels.js (since it's only dealing with admin links which one might not use). And since we created a whitelist for CSS files, only specified files will be added to pages, thus only allowing system.base.css and system.messages.css in the example above.

The * wildcard can be used in paths. This is useful since you sometimes don't know exactly where a module lives (in sites/all/modules or in profile/[profile]/modules).

Project information