Programming Software

Introducing RequireWP

I built this new WordPress plugin, RequireWP, to help speed up the web. It extends WordPress’s WP_Scripts class to write your script requirements out with Require.js syntax. I have seen a ~20% speed increase (decline in load time) on this site which is using the plugin as well. After installing I just had to modify the theme’s required scripts since a few were not set correctly.

Note that some plugins and themes may not work correctly due to incorrectly set script dependencies – most script issues can be corrected just by correcting them. Some others may be requiring the script to be available within the body of the page without checking or waiting – this should not be done, but some developers do this anyway. This plugin is design to encourage the use of dependency callbacks, deferred and asynchronous script execution.

Take a look at the documentation and download it today (can also be installed directly from within WordPress):

RequireWP WordPress plugin header: "RequireWP" on top of a black barbell with a blue motion-blurred target to the right.
Click to download RequireWP

3 replies on “Introducing RequireWP”

Hi Jim! Just tested RequireWP on a test website of mine, and it seems to work pretty well!

Except when loading resources using protocol-relative URL’s: // instead of https://. When using //, it’s not seen as an external resource. And, looking at TwentySeventeen, jquery.js might have to be excluded (couldn’t find that in the documentation).

In all, great work!

Thanks for the report and testing it, I will take a look! I know I had a local copy of the Twenty Seventeen theme running fine with the plugin but I will double-check that as well!

Jan, I corrected the schema/protocol agnostic URL handling in version 1.0.2. I also tested the TwentySeventeen theme and did not see any issues. If you have any custom code that is running or a an error you are getting let me know and I will see if I can figure out what is causing it.

Leave a Reply to Jim Cancel reply

Your email address will not be published. Required fields are marked *