Jettison unwanted CSS and JavaScript files!
This module provides a hook-based mechanism for getting rid of unwanted CSS and JS files. Simply declare which files you want deleted, and this will take care of removing them.
There's also a nice administration interface that can be used for simple cases.
What is it good for?
Sometimes a module adds CSS or JS that you don't want (or don't want to show up on non-admin themes). Use Jettison to get rid of them.
Occasionally, modules put their CSS/JS on every page when it should really only be on a few isolated pages. A jettison hook can be used to detect the conditions and then remove strategically.
Examples
Say we have a module called Example, and we want to remove the foo.js
that some other module adds. Here's how to accomplish this in Jettison's API:
function example_preprocess_page(&$vars) {
$icky_js = drupal_get_path('module', 'foo') . '/foo.js';
jettison_js($icky_js, 'module');
}
Or to remove a CSS file from some offending theme (yes, this would be an edge case), we can do this:
function example_preprocess_page(&$vars) {
$ugly_css = drupal_get_path('theme', 'ugly') . '/foo.css';
jettison_css($ugly_css, 'theme');
}
If your needs are more sophisticated than a simple removal, you might want to look into the following API functions: