This is a strange one... javascript_aggregator is doing its thing. The .jsmin.js files are being created, and the $scripts variable appears to be updated correctly in preprocess_page to reference the minified version rather than the standard one. However, when the $scripts variable is printed in my page.tpl template, the non-minified version is output. The strange thing is that I have tried inserting a dsm() call to show me the contents of $scripts right before the line that prints it in page.tpl, and I can see that it DOES reference the minified version. But on the very next line when the $scripts variable is printed to the stdout, it references the non-minifed version, and that is what my browser gets! Any ideas what could be going here?
Comment | File | Size | Author |
---|---|---|---|
#4 | javascript_aggregator_preprocess_page.patch | 976 bytes | derjochenmeyer |
#2 | javascript_aggregator_preprocess_page.patch | 1.02 KB | derjochenmeyer |
#2 | javascript_aggregator.install.zip | 932 bytes | derjochenmeyer |
Comments
Comment #1
mrfelton CreditAttribution: mrfelton commentedupdate: ok, so I had a caching issue which was skewing this a little and after disabling all of my caches, doing a dsm of $secript in page.tpl itself actually does show that it references the non-minified version... I have since managed to get javascrip_aggrigation to work, but only by adding this in my theme's template.php:
function mytheme_preprocess_page(&$vars) {
$vars['scriptsmin'] = $vars['scripts'];
}
and then referencing $scriptsmin in page.tpl.
So, when my theme's preprocess_page function is run, $scripts contains the correct js, but at some point between here, and actually printing the variable, it is being reset.
Comment #2
derjochenmeyer CreditAttribution: derjochenmeyer commentedDo you have jquery_update installed?
We need to do 2 things in order to keep Javascript Aggregator working.
We can do the same
Attached is an .install file and a patch for javascript_aggregator.module (6.x-1.x-dev, 2009-Mar-23) which sould solve this issue.
To get this working:
function javascript_aggregator_theme_registry_alter
from above manually)Please test.
Comment #3
derjochenmeyer CreditAttribution: derjochenmeyer commentedComment #4
derjochenmeyer CreditAttribution: derjochenmeyer commentedFixing the comment of
hook_theme_registry_alter
for Javascript Aggregator inspired by jQuery Update. Use in combination with javascript_aggregator.install from #2.Comment #5
jannalexx CreditAttribution: jannalexx commentednice, same issue
and your patch/install mod did the trick (latest dev)
combined with CSS Gzip, I just saved 200k css/js from my front page, verycool...
Comment #6
derjochenmeyer CreditAttribution: derjochenmeyer commentedThanks for your feedback. I'll include it in the next release of Javascript Aggregator.
Anyone else who tried this patch? Please test.
Comment #7
derjochenmeyer CreditAttribution: derjochenmeyer commentedAdded this to current dev.