Turning Off Drupal CSS and JavaScript Aggregation With Drush

Monday, February 4, 2013 - 15:07

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.

1
2
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.

1
2
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
Category: 
philipnorton42's picture

Philip Norton

Phil is the founder and administrator of #! code and is an IT professional working in the North West of the UK.
Google+ | Twitter

Add new comment