I am using my own simple custom theme (with the default regions). One change I made was to put $scripts just above the $closure to ensure that all JS was not in the header.
From what I can tell, the minifying option of this module will only work if the JS files are located in the footer of the page.
(from javascript_aggregator.module)
function phptemplate_closure($main = 0) {
$footer = module_invoke_all('footer', $main);
$js_footer = drupal_get_js('footer');
// Only do this for pages that have JavaScript on them.
if (!empty($js_footer)) {
$js_footer = _javascript_aggregator_minify($js_footer);
}
return implode("\n", $footer) . $js_footer;
}
Even though my JS not in the header (it's just before the closure) it is not being minified. I am guessing this is because most modules assign JS to the default $scope which is 'header'.
In order to get around this, I made the following change to the module, and now it works perfectly with my sites:
function phptemplate_closure($main = 0) {
..
$js_footer = drupal_get_js('header');
..
}
I feel that I am missing something with the usage of this module or I need to do something in my theme layer. Is there another way to get all of the JS in my pages into the 'footer' so that I do not need to hack the module?
Comments
Comment #1
kentr commentedMine is getting minified in the header.
Are you using JSMin or JSMin+? Could this be your issue:
#617742: JSMin not working. Incorrect file permissions on jsmin.php?
Comment #2
srobert72 commentedSubscribing. Same issue.
JavaScript files moved from header to bottom (before closure) aren't minified.
Comment #3
srobert72 commented@andrewsuth
Maybe you use Parallel module.
In this case see : #619112: Incompatibility with Javascript Aggregator
It was cause of my problem.
Comment #4
derjochenmeyer commentedJavascript Aggregator minifies JS in Header and Footer
Header:
Footer:
If it is related to Parallel Modul see:
#770374: Incompatible with Parallel module