After installing it on a plugin-heavy site, there is no difference whatsoever visible in PageSpeed or YSlow.
I still get the same warnings. The same amount of scripts being loaded in the head as before installing this plugin: plus one – the plugin’s JS itself…
How does one use this plugin in the correct way?
]]>My wordpress install is in its own directory. So rather than at “https://victorwyee.com”, it’s at “https://victorwyee.com/home”. However, HeadJS Loader doesn’t seem to recognize this and is trying to load JS from the root URL instead of the correct subdirectory.
So I get errors like this in my console: GET https://victorwyee.com/wp-includes/js/jquery/jquery.js 404 (Not Found)
and other JS from wp-content/plugins, etc.
Any way to fix this?
Thanks!!!
]]>There’s a setting for where in the HTML to place the head.js loader, but if a script is enqueued after that point then it’s ommitted. It would be extremely helpful if any scripts enqueued after the main head() could be loaded at the end.
For example, consider a Google Maps script that’s only needed on pages about specific events. You don’t know until the page itself that the map is going to be necessary, so you don’t load the script on every page; instead you enqueue it as you reach that point.
WordPress’ enqueue_script function has a setting for “script should be loaded in the footer”. It would be useful for head.js to respect that, and write in the footer any scripts that couldn’t or shouldn’t be written in the header.
]]>After activating the HeadJS, Disqus stops working. All other JS scripts seems fine.
Thanks
]]>Hello,
Firstly congrats on providing such an excellent plugin.
I was wondering whether it is possible to exclude certain Javascripts from loading within the plugin? This would be an excellent feature and one that I’m sure would appeal to many other people.
If this can be done, can you please let me know how?
If not, do you plan on implementing such a feature on future releases?
Regards,
Paul
]]>The plugin seems to break facebook integration and my ads on my site. Please let me know if you would like more information.
]]>Since the latest version is 0.96 (stable)
https://github.com/headjs/headjs
Hi,
cdnjs is a great CDN platform to host JS files. Luckily, headjs is already hosted by it. Therefore, I make the following change to utilize this resource.
headjs-loader.php: Line 77, change from:
$headJS = '<script type="text/javascript" src="' . get_bloginfo('wpurl') . '/wp-content/plugins/' . $this->_pluginName . '/head.min.js"></script>';
to
$headJS = '<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/headjs/0.96/head.min.js"></script>';
Enjoy.
]]>Hi,
I activated this and it seemed to install without issue, but when I look at the source of a page, I don’t see any difference in the way the scripts are being handled. It doesn’t seem that the scripts are being handled by this plugin, at all?
You can see here: krowchukdressage dot com
]]>This plugin, although awesome, breaks Typekit. That, in turn, makes me sad.
]]>Hi
Seems to be breaking ‘Joliprint’ and ‘Like it? Tweet it!’ plugins when enabled.
Any help would be appreciated.
Elijah
]]>A syntax error in HeadJS’ Loader will indeed cause the scripts to load in parallel, but they will not execute in order as per HeadJS’ design. This can lead to, for example, a script loading before jQuery does and all hell breaking loose. This might be browser dependent (I didn’t test), but I was able to fix it by modifying the script to use HeadJS’ syntax, like so:
if (!empty($script_array)) {
$script_array = array_unique($script_array);
$i=0;
foreach ($script_array as $script_location) {
/* Load the scripts into a .js */
if ($i != 0) { $js_files .= "\n "; }
$js_files .= '"' . $script_location . '"';
if ($i + 1 != count($script_array)) { $js_files .= ","; }
$i++;
}
$headJS .= "\n<script>\nhead.js(" . $js_files . ");\n</script>";
}
This may also be a side effect of me upgrading to the latest HeadJS (0.9). But that needs to be done at some point, also. XD
]]>I’ve been attempting to deploy HeadJS across numerous sites with the following plugins also installed:
1. Gigya or Janrain Engage
2. WP-Minify
In both instances with the OpenStack services (Gigya, Janrain Engage) HeadJS can’t seem to parse their JS scripts correctly, breaking third party authentication.
Also, WP-Minify has serious problems with HeadJS as HeadJS attempts to place all the minified JS data inside it, yet Minify expects it outside of the HeadJS loader functionality.
]]>Excellent plugin thanks for it.
There is a minor bug I think. Apache error log shows the following errors but plugin works without a problem.
PHP Warning: array_unique() [function.array-unique]: The argument should be an array in …/wp-content/plugins/headjs-loader/headjs-loader.php on line 75
PHP Warning: Invalid argument supplied for foreach() in …/wp-content/plugins/headjs-loader/headjs-loader.php on line 77
]]>