I have a couple custom modules that I add javascript via drupal_add_js(). I have all the Bandwidth Optimizations options checked in the performance page (/admin/config/development/performance).

Since I have Aggregate JavaScript files checked, should all my javascript files be aggregated into one file? Is this normal behavior?

  • 1
    Well, that's weird. I tried drupal_add_js() myself and the file is being aggregated correctly, where in your code is called drupal_add_js()? Make sure the preprocess option isn't set to FALSE by another module. Dec 27, 2014 at 17:43
  • Agreed. Can you show us an example of one of your files that is not being aggregated?
    – webkenny
    Dec 27, 2014 at 19:14
  • 1
    Welcome to Drupal Answers! Since the question is about code, you should show the code you are using, or the question is not much helpful to future readers, which is what Stack Exchange aims. Also, it is difficult to say what you are doing wrong without actually seeing what you are doing. :)
    – apaderno
    Dec 27, 2014 at 19:26

1 Answer 1


The reason it wasn't aggregating is that someone had every_page set to FALSE and preprocess set to FALSE(as @thedotwrite was saying in comment above) in a lot of drupal_add_js() calls. (Some of them were set like this because they really shouldn't have been on every page but there were some that really could be on every page).

Not sure why I didn't notice that before :)

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.