“Don’s Optimization Anthology Plugin” (abbrev.: OAP)
A couple of weeks ago, I made a simple WordPress-plugin (my first ever, actually) called: “Don’s Optimization Anthology Plugin” (abbreviated to: “OAP”)
This plugin is an “anthology” of (IMO) some snazzy WordPress-functions that I’ve across over time, which I usually use to optimize my WordPress-installations from time to time (typically for improving load-times and such…).
Not that I’m expecting this plugin is to set the WordPress-world on fire, but the following functions that this plugin quietly performs are ( – for now, as more functions might be added a a foreseeable future):
- Checks if Server-side compression is switched on
- Links commonly-used jQuery-libs to a CDN (here cdnjs.com)
- Adds Alexandre Dieulot’s fascinating “instant.page”-functionality
- Adds SRI hashes and parameters on relevant URI’s (for obvious security reasons)
- Removing versions + params on URI’s
- Sharpen resized image files
- Deferring/async’ing of js-files
- Embedding “Above The Fold” Critical Path CSS, defering CSS-files (by using a hack) and moving js from the head to the footer
- Minifying all HTML-used, by stripping line-breaks and unnecessary white-spaces
This plugin will work right out of the box – almost…
For now, you’re going to have get hold of the “Above The Fold” Critical Path CSS on your own hand, and insert the generated string into the code in file, “OAP_plugin.php”.
You can find the “Above The Fold” Critical Path CSS-string by using Jonas Sebastian Ohlsson’s generator at:
https://jonassebastianohlsson.com/criticalpathcssgenerator/
Follow the instructions here, and copy and paste the generated string into the file (OAP_plugin.php; line 158 – or thereabouts) – further details are explained in the source code found in “OAP_plugin.php”.
Planned/”Wish-list”:
Future versions of this plugin might have implemented provisions to ease this process by inserting the generated “Above The Fold” Critical Path CSS-string via the admin-panel.
Credits:
This WordPress-plugin is compiled and effectuated by various pieces of code that herald fom various sources/authors. These various sources are credited within this plugin’s source-code, and must NOT be removed. This plugin’s collecton of code used herein is collected, “compiled” and assembled by this author.
Changelog: 1.0.2ß: January 17th, 2021
- Hunted down and removed/fixed some optimization bugs and minor bottle-necks
- Added comments referencing were the a newly-added code was found/heralds from
- Cleaned up/tweaked a little bit/commented on Matthew Horne’s async-/defer-script
- Commented out strings of code which either isn’t used currently (due the used theme/plugins) – or not necessary at all
- Added cherryaustin’s code-solution in adding SRI-strings and parameters to URI’s, due to safety-concerns and to prevent potential safety issues
- Changed the code to inject the “instant.page”-script URI (For further details: https://instant.page) by using WordPress “wp_register_script”- and “wp_enqueue_script”-functions, instead.
1.0.1ß: January 16th, 2021
Added code to inject the “instant.page”-script URI (For further details: https://instant.page)
1.0.0ß: January 7th, 2021
“Don’s Optimizaion Anthology Plugin (OAP)” generated and initialized
License:
This plugin is released under the: Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-nc-sa/4.0/)
Furthermore, the Creative Commons License shown above regarding the template(s) is here extended by the following limitions pertaining to warranty and liabiltiy, in which also the following also applies:
THIS SOFTWARE (I.E.: THIS PLUGIN) IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING – BUT NOT LIMITED TO – THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
By obtaining and using the here-provided software, the user – implicitly – acknowledges and accepts the terms and conditions stated above regarding the aforementioned software.
Please note that this plugin is still in BETA, for better or worse, and for now I would definitely NOT recommend this plugin to be used in production, for the time being!
So for now: Use at your own discretion and risk!
You can access the latest version of the plugin from the following-link:
https://donvoorhies.github.io/oap/
Major-updates will be posted here, on the site listed above (the OAP-plugin’s official website) and it’s Github-repository: https://github.com/donvoorhies/oap.
I have currently no plans sharing the plugin via WordPress, but this might happen in the future.
Thanks for reading this…!