This patch defers minified JavaScript injection to the end of head, ensuring that any excluded dependencies such as jQuery have been loaded first.
--- wp-minify.old 2010-02-07 18:23:34.000000000 -0500
+++ wp-minify.php 2010-02-07 19:04:05.000000000 -0500
@@ -575,7 +575,7 @@
}
// HTML5 has <header> tags so account for those in regex
- $content = preg_replace('/<head(>|\s[^>]*?>)/', "\\0\n$js_tags", $content, 1); // limit 1 replacement
+ $content = preg_replace('/<\/head(>|\s[^>]*?>)/', "$js_tags\n\\0", $content, 1); // limit 1 replacement
}
return $content;
}