Short Introduction

Makes it possible to manage themes' CSS and Javascript files with no coding and via theme .info file.
IE conditional comments support for both CSS/JS, replacing and disabling core and contributed modules' CSS/JS files, adding inline JS/CSS, Regular expression support!, are just few of the special features it offers.

Introduction

The problem with Drupal theming is that in most cases we have to write at least few lines of code. And it's occurring more often because of new complicated modern cross browsers html5 templates :). If we need to for example remove some third party modules' stylesheets or javascripts due to the conflict with the theme styles/scripts, there is no way other then writing code. So theming in Drupal has become a tedious task specially for non programmers or even for programmers with no familiarities with Drupal API. No wonder we have so few high quality Drupal themes :(

The purpose of this module is to eliminate this complexity once and for all, at least for styles and scripts. To achieve this .info is extended by the module and several new parameters are added which gives us the power to have total control over styles and scripts.

So lets have a look at the supported features :

  • Full support for drupal_add_css and drupal_add_js parameters and even more!
    • Adding external files
    • Defining where to include it : header / footer
    • Adding inline css/js
    • Whether to display on all pages or not
    • Defining style/script group : theme / module / core
    • Weight (the order of adding to the page)
    • Supporting Defer parameter
    • Enable/Disable caching per style/script
    • Enable/Disable preprocessing
    • Enable/Disable using core
    • Adding attributes like id to stylesheet/javascript include tags
    • Support for IE conditional comments for both styles and scripts
    • Defining style media : print/all/screen
  • Manipulating existing styles/scripts
    • Creating a white-list or blacklist to decide which style/scripts should be added to the page
    • Possibility of replacing and overriding core and contributed modules styles and scripts using only the info file
  • Possibility of altering the scripts and styles (hook_js_alter and hook_css_alter support for Drupal 6)
  • Compatible with most of the style and a script manipulation modules
  • Adds theme_path variable to be used by template files and css_js_total_control_get_theme_path function

Some Examples

Replacing core jquery!

  scripts-settings[filter][rules][0][function] = regular_expression
  scripts-settings[filter][rules][0][pattern] = %misc/jquery|jquery_update%
  scripts-settings[filter][type] = blacklist

  scripts-extended[js/vendor/jquery.min.js][scope] = header
  scripts-extended[js/vendor/jquery.min.js][weight] = 0
  scripts-extended[js/vendor/jquery.min.js][group] = core

Adding an inline script to bottom of the html!

  scripts-extended[js/menu-effect.inline.js][scope] = footer
  scripts-extended[js/menu-effect.inline.js][type] = inline

Credit

Original codes comes from Conditional Stylesheets, Thanks JohnAlbin for sharing his work.

Drupal 8

Since great deal of this module is now in core [#2216195], there won't be any Drupal 8 version.

Supporting organizations: 
Sponsoring the development and maintaining

Project Information

Downloads