Conversation
b1229da to
88ff247
Compare
|
@westonruter @adamsilverstein I have converted this into a standalone plugin. Next, I'll add a settings page to opt-in offloading for scripts listed in the Partytown documentation (https://partytown.builder.io/common-services). This way, the WordPress plugin team won't classify it as a "framework" plugin, as @westonruter previously mentioned. |
9d4c497 to
e7668c6
Compare
* Web Worker module allows to run scripts within a worker thread with the help of Partytown library.
* Replace output buffering with get_echo() function * Update creation of expected string of script tag with type="text/partytown"
* Removed scripts from done items in global $wp_scripts
- Include partytown library files at plugin release.
westonruter
left a comment
There was a problem hiding this comment.
Just some trivial suggestions left from me. Pre-approving so that once @adamsilverstein approves this can finally be merged!
Co-authored-by: Weston Ruter <westonruter@google.com>
Co-authored-by: Weston Ruter <westonruter@google.com>
| array_key_exists( $handle, wp_scripts()->registered ) && | ||
| in_array( 'web-worker-offloading', wp_scripts()->registered[ $handle ]->deps, true ) | ||
| ) { | ||
| $html_processor = new WP_HTML_Tag_Processor( $tag ); |
|
Code looks good to me, doing some manual testing next. |
|
Testing this locally with the sample code from the ticket description, I noticed the script handle is different, I had to use Once I did that, the tag got the partytown type added: question: do we want to remove the I didn't test actual Partytown functionality yet, that will be easier to do once we ship the plugin. Are we planning add script specific handling (eg analytics) in the future? |
Ah, that's my bad. I updated the slug in the codebase but didn't do it in the description. Updated now.
You're right. This can be removed as well. Or the |
Co-authored-by: Weston Ruter <westonruter@google.com>
|
In 44c469c I addressed a case where a script may already have the ✅ Good to merge. |
|
Follow up: #1468 |

Summary
Fixes #176
Previously: #556
Relevant technical choices
wwo_configurationfilter which can be used to update web worker configurations.Testing steps
Enable this performance plugin or use
wp-envin which this plugin is enabled by default on this branch.Add a JS script with
web-worker-offloadingas a dependency. When the page is loaded, the JS script should be loaded within the web worker.Use
wwo_configurationhook to update web worker configurations.