Minifying of JS is only done if the JavaScript is in the 'footer'.
| Project: | Javascript Aggregator |
| Version: | 6.x-1.3 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
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)
<?php
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:
<?php
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?

#1
Mine 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?