Is it possible to disable CSS and Javascript aggregation by role?

That way during content editiong or administration stages the user is not affected and can check the CSS alright, while end users received cache values as usual. If the cache lifetimes are long enough the editing can be completed before it any changes interfere with the other users.

1 Answer 1


To do exactly what you want; using hook_css_alter & hook_js_alter is how to do it. Set the preprocess key to FALSE for everything.

For an out of the box solution that is fairly close to what you want https://www.drupal.org/project/advagg/ can do it. Give that role the "bypass advanced aggregation" permission and then they can add ?advagg=-1 to the end of the URL to see the change.

Will also mention that using a dev environment when altering css/js is ideal.

  • Does this override the standard Drupal aggregation, ie it makes it standard aggregation irrelevant whether it is enabled or not?
    – vfclists
    Commented Feb 7, 2015 at 5:46
  • It does override the standard Drupal aggregation, but it uses the settings under "Bandwidth optimizations" on admin/config/development/performance as the on/off control.
    – mikeytown2
    Commented Feb 7, 2015 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.