Drupal 7: Turning Off Drupal CSS and JavaScript Aggregation With Drush

I often find that after recreating a Drupal site locally to do some testing that I have left CSS and JS aggregation turned on. This can be turned off easily enough via the performance page, but this often breaks the flow of what I am doing. As an alternative I use Drush to reset the values via the command line.

The Drush command variable-set can be used to alter any value in the variable table. The two values needed for CSS and JavaScript aggregation are preprocess_css and preprocess_js. To turn these values of we just set them to 0 like this.

drush variable-set preprocess_js 0
drush variable-set preprocess_css 0

This can be shortened by using vset, which is Drush shortcut for variable-set.

drush vset preprocess_js 0
drush vset preprocess_css 0

To see what the existing value of a variable is just the variable-get command. This can also be shortened to vget.

drush vget preprocess_js

As an alternative, if you just want to flush the CSS and JavaScript caches then use the cache-clear command (shortened to cc) with the flag css-js.

drush cc css-js

If you have anonymous page caching turned on then you might also need to disable that. This can be done by setting the cache variable to 0.

drush variable-set cache 0

Add new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
4 + 10 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.