From 73d74f1cc7b19c0da0e4965b4c76ad43e7727a83 Mon Sep 17 00:00:00 2001 From: Shreeram Narkhede <126403314+shreeram2302@users.noreply.github.com> Date: Thu, 17 Jul 2025 19:12:41 +0530 Subject: [PATCH 1/2] docs: improve readme with purpose, usage, hooks, caveats, whitelisting --- README.md | 48 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 0eaa955..a644344 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,46 @@ -# rt Scripts Optimizer +# ⚡️ rt Scripts Optimizer -A WordPress plugin that improves Core Web Vitals score by loading scripts via worker thread. Keeps the main thread idle for users to interact with page as quickly as possible. +**rt Scripts Optimizer** is a lightweight WordPress plugin that improves your website’s **Core Web Vitals (CWV)** scores by intelligently deferring non-critical JavaScript execution using **Web Worker threads**. This ensures a snappy, interactive experience for users by keeping the **main thread free** during page load. +--- -## Features +## 🚀 Key Features -1. **Uses Worker Thread** - This plugin uses worker thread for all the scripts loaded via `wp_enqueue_scripts` function, to minimize the main thread scripts execution, and loads them only on the user interactions like tap, click, scroll or keypress events. -2. **Disables Emojis** - Removes core WP Emojis javascript to reduce extra script execution. +- ✅ **Worker Thread Script Loading** + Loads JavaScript via Worker Threads, deferring script execution until user interaction (click, scroll, tap, keypress), improving First Input Delay (FID). -## How it works? +- ❌ **Disables Default Emojis Script** + Removes WordPress’s default Emoji script to reduce render-blocking JS. -1. With the help of `rt_scripts_handler` function hooked with `scripts_loader_tag` filter, the function outputs all script tags with `type="text/rtscript"` which are loaded via `wp_enqueue_scripts`. -2. You can filter or skip some javascripts incase any error occurs by adding script handle like this and then scripts will load normally on main thread by path or handles via backend plugin option. +- ⚙️ **Script Whitelisting Support** + Allows you to exclude certain scripts from being deferred if they cause issues. -## Does this interest you? +--- -Join us at rtCamp, we specialize in providing high performance enterprise WordPress solutions +## 🧠 Why Use This Plugin? + +If you're trying to: +- Fix **poor CWV metrics** on PageSpeed Insights +- Improve **FID**, **LCP**, and **CLS** +- Defer third-party JS without manually editing theme files +- Keep the **main thread idle** during page load + +Then this plugin is a great fit. It automatically detects and defers scripts without any code changes needed from your end. + +--- + +## 📦 When Should I Use It? + +Use this plugin if: +- You're seeing performance warnings related to JS blocking the main thread +- Your site is JS-heavy (e.g., page builders, animations, tracking) +- You want a **non-invasive optimization solution** that doesn’t modify core theme files + +--- + +## 🛠️ How It Works + +1. The plugin hooks into the `script_loader_tag` using `rt_scripts_handler`. +2. It changes script tags generated by `wp_enqueue_scripts` to: + ```html + From 6b3226ac6ee1a6f42fa3e1d808932815bd1e123a Mon Sep 17 00:00:00 2001 From: Shriram Narkhede <126403314+ShriramNarkhede@users.noreply.github.com> Date: Thu, 7 Aug 2025 12:55:40 +0530 Subject: [PATCH 2/2] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index a644344..3b56a44 100644 --- a/README.md +++ b/README.md @@ -44,3 +44,9 @@ Use this plugin if: 2. It changes script tags generated by `wp_enqueue_scripts` to: ```html + +--- + +## Does this interest you? + +Join us at rtCamp, we specialize in providing high performance enterprise WordPress solutions