Does aggregating JS/CSS interfere with my drupal_add_js()? I want to use drupal_add_js and drupal_add_css on a per-page basis so I have added a 'scripts' text field to my basic content type and have set the Format Type to PHP.

It works beautifully until I turn js/css aggregation back on; then, none of the files I specified are loaded.  Why?


Because Drupal is still using the previously aggregated files (despite me flushing the cache many times).
Because of some more sinister issue that will prevent me from adding my CSS/JavaScript in this manner.


I see other people doing the same thing here: https://drupal.org/node/290982.
Yes, drupal will definitely miss your custom JS scripts in it's js aggregation build phase, if you're loading JS on different pages. This is because by the time a user (or you) hits the other pages, the aggregated js file has already run previously, and created the cached JS file it thinks is all it needs. It uses this cache file until the cache is cleared or the crontab is run.

A couple of options are to either:


try using the drupal_add_html_head() function to add the js when ever you want, or,
write some js to detect what library is needed (perhaps based on a data attribute element in the markup), and then conditionally load the other js via the getScript method.


Good luck.