manifest / performance / wp-partytown
WP PartyTown archived
Add partytown support to WordPress sites.
by rtCamp, thelovekesh · github.com/rtcamp/wp-partytown · website
★ 81stars
7forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/rtcamp/wp-partytown/archive/refs/heads/develop.zipDeclares an update source (https://github.com/rtCamp/wp-partytown), so updates arrive through the plugin's own updater.
From the readme
WP Partytown
This plugin is a POC for ticket #176 in WordPress/performance repo.
Goals
1. Allow plugin developers to execute scripts inside a Partytown Web Worker.
2. Allow site admins to select which scripts they want to execute inside a Partytown Web Worker.
Proposal and Working of Plugin
1. Scripts with dependency as partytown will be executed inside a Web Worker.
Create a function to enqueue scripts with dependency as partytown and it will add partytown support to the script by appending the type="text/partytown" attribute.
Output:
2. Expose a filter to allow plugins to configure partytown
By default Partytown does not require a config for it to work, however, a config can be set to change the defaults. At the lowest level, it’s configured by setting the window.partytown = {...} object before the Partytown snippet script.
3. Show option to enable/disable partytown on Website
To get started with Partytown on a website, you need to add a script partytown.js to your website. While the partytown.js file could be an external request, it’s recommended to inline the script instead.
Showing an option to enable it ensures that script should be included only when needed.