OK, let me ask this question in a different way: is there any way to affect where in the HTML the combined JS is placed?
Well, I did some digging and what I’ve learned is that when JS Minify is in “auto” mode, it puts the combined JS at the top of the head. I was able to alter the plugin code to get it to place the code at the foot of the body tag, so now all my wp_localize_scripts() variables are set before the scripts are loaded.
Getting my jQuery from Google still, but now it’s OK, because the combined JS is now loading at the end of the document.
You have to use manual mode to load remote files in W3TC in the current releases.
Hi xnau,
good digging in the code!
I am actually having the same problem, but I would rather not use the manual mode, so I was wondering if you could share the patch.
Frederick, amazing job with the plugin.
Is there any reason to put the the minified code at the top of the head? Would it be possible to make it configurable?
thanks guys!
Riccardo
Hey guys,
in the end I found this article from the forum and the suggestions worked.
Now the file to modify is Minify.php and not Plugin.php, but the trick pretty much did it.
Great!
Riccardo
http://www.gurtip.it
When you keep getting an error that jquery is not loaded, you need to check this bug-report or implement Riccardo’s hack and also do the following steps.
find the following code in Minify.php:
if ($ext != ‘.js’ && $ext != ‘.css’) {
return false;
}
And add just below or above:
// don’t add jquery in the cache
if (strpos($file, “jquery.min.js”)===true) {
return false;
}
Alternatively you could choose to prevent everything that is from google-apis as these are probably cached within the browser:
// don’t add css/js hosted by googleapis
if (strpos($file, “googleapis.com”)===true) {
return false;
}
Hope this helps!