Add partytown support to WordPress sites.

Overview

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.

wp_enqueue_script(
  'non-critical-script',
  plugins_url( 'non-critical-script.js', __FILE__ ),
  array('partytown'),
  '1.0.0'
);

Output:

// Loaded in Partytown Web Worker
<script type="text/partytown" src="/wp-content/plugins/labs/non-critical-script.js?ver=1.0.0"></script>

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.

function my_plugin_partytown_config( $config ) {
  $config["debug"] = true;
  return $config;
}
add_filter( 'partytown_configuration', 'my_plugin_partytown_config' );
<script>
    window.partytown = {
        debug: true
    };
</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.

You might also like...

A service to add web page screenshots to your Eleventy sites.

Screenshot API A runtime service to use live website screenshots on your site. Usage Image URLs have the formats: https://v1.screenshot.11ty.dev/:url/

Dec 24, 2022

Superkeys allow users to add short keys for websites and make search query in those sites.

Superkeys allow users to add short keys for websites and make search query in those sites.

Superkeys is a browser extension which allow users to add short keys for websites and make search query in those sites. Made with ❤️ @nilooy 🧑‍💻 Dem

Aug 17, 2022

Query for CSS brower support data, combined from caniuse and MDN, including version support started and global support percentages.

css-browser-support Query for CSS browser support data, combined from caniuse and MDN, including version support started and global support percentage

Nov 2, 2022

The JavaScript and API powered WordPress.com

The JavaScript and API powered WordPress.com

Calypso Calypso is the new WordPress.com front-end – a beautiful redesign of the WordPress dashboard using a single-page web application, powered by t

Dec 30, 2022

Analysis of WordPress 3D Print Lite 1.9.1.4 - arbitrary file upload vulnerability.

Analysis of WordPress 3D Print Lite 1.9.1.4 - arbitrary file upload vulnerability.

3DPrint-Lite-1.9.1.4-File-Upload Analysis of WordPress 3D Print Lite 1.9.1.4 - arbitrary file upload vulnerability. The Vulnerability: This vulnerabil

Mar 15, 2022

Small (fragile) script for migrating comments from dev.to posts to Wordpress format (WXR/XML)

dev-to-wxr Small (fragile) script for migrating comments from dev.to posts to Wordpress format (WXR/XML). Useful for importing in tools like disqus. U

Jan 29, 2022

Examples of how to re-create the WordPress Template Hierarchy using headless clients and WPGraphQL

WPGraphQL Template Hierarchy Debugger This is a project to demonstrate how to re-create the WordPress template hierarchy with Headless WordPress using

Oct 29, 2022

A dashboard for managing orders and inventory for a wordpress e-commerce site which has woo commerce plugin installed

A dashboard for managing orders and inventory for a wordpress e-commerce site which has woo commerce plugin installed

WordPressWooCommerceDashboard - A dashboard for managing orders and inventory for a wordpress e-commerce site which has woo commerce plugin installed. This program provides shipping tracking for Delhivery.

Jan 3, 2022

Lucaslitton.me - Personal website built with ReactJS, Frontity, and WordPress.

lucaslitton This project was bootstrapped with Frontity. Table of Contents Launch a development server Create your custom theme Create a production-re

Jan 3, 2022

Personal Blog - a project developed with Angular for the front-end interface and Wordpress for the back-end API served with Docker containers

Personal Blog - a project developed with Angular for the front-end interface and Wordpress for the back-end API served with Docker containers

PersonalBlog This project was generated with Angular CLI version 13.0.1. Front-end Interface Development server Run ng serve or ng serve --configurati

Oct 5, 2022

This Next.js app replicates the WordPress Template Hierarchy, but in JavaScript

Next.js WordPress Template Hierarchy Routing This Next.js app replicates the WordPress Template Hierarchy, but in JavaScript! Requirements WordPress P

Oct 31, 2022

PostCSS plugin to render WordPress global styles from a theme.json file

postcss-wp-global-styles PostCSS plugin to render WordPress global styles from a theme.json file. As of now it only supports preset styles. Usage @wp-

Aug 5, 2022

Integrate Tailwind with the @wordpress/create-block script.

Integrate Tailwind with the @wordpress/create-block script.

Tailwind Blocks Example plugin demonstrating how to integrate Tailwind with the @wordpress/create-block script. The plugin was scaffolded using @wordp

Nov 13, 2022

Turn any dynamic website (especially wordpress) into a fast, secure, stable static site

Static site publisher Turn any dynamic website (especially wordpress) into a fast, secure, stable static site Reduced complexity - no need to run simp

Apr 6, 2022

WordPress Gutenberg plugin to display the attributes for the currently selected block in the Document sidebar.

WordPress Gutenberg plugin to display the attributes for the currently selected block in the Document sidebar.

Block X-ray Attributes Stable Tag: 1.2.0 Requires at least: 5.5 Tested up to: 5.9 Requires PHP: 7.2 License: GPL v2 or later Tags: block attributes, g

Mar 18, 2022

An experimental plugin to preview and insert block patterns in WordPress.

An experimental plugin to preview and insert block patterns in WordPress.

Block Pattern Explorer The Block Pattern Explorer is an experimental WordPress plugin based heavily on the work currently being done in Gutenberg. The

Oct 19, 2022

A Simplized Wordpress Blog Theme Design & Developed from 2broear.com by 2BROEAR Released & openSourced in 2022.

A Simplized Wordpress Blog Theme Design & Developed from 2broear.com by 2BROEAR Released & openSourced in 2022.

2BLOG THEME A Simplized Wordpress Blog Theme Design & Developed from 2broear.com by 2BROEAR Released & openSourced in 2022. Preview Site :演示站点 (演示并不代表

Dec 8, 2022

Theme Redone is a custom WordPress theme starter/framework with its own Gutenberg blocks solution and a CLI that speeds up the block creation process.

Theme Redone is a custom WordPress theme starter/framework with its own Gutenberg blocks solution and a CLI that speeds up the block creation process.

Theme Redone The Framework for Developing Custom WordPress Themes with its own Gutenberg Blocks creation solution. Theme Redone is a custom WordPress

Dec 30, 2022

The most advanced responsive front-end framework in the world. Quickly create prototypes and production code for sites that work on any kind of device.

The most advanced responsive front-end framework in the world. Quickly create prototypes and production code for sites that work on any kind of device.

Install | Documentation | Releases | Contributing Foundation is the most advanced responsive front-end framework in the world. Quickly go from prototy

Jan 4, 2023
Comments
  • Console error after plugin setup

    Console error after plugin setup

    @thelovekesh The plugin looks great! I have a problem setting up the plugin. I activated the plugin and I'm seeing an error. I didn't enqueue any script for Partytown yet. Is this a bug in the plugin or Partytown? Maybe it's on my end?

    Here are some screenshots:

    Screenshot 2022-09-29 at 15 32 38 Screenshot 2022-09-29 at 15 36 23
    opened by pogla 1
Owner
rtCamp
Enterprise WordPress Solutions for Publishers & eCommerce
rtCamp
Bree is the best job scheduler for Node.js and JavaScript with cron, dates, ms, later, and human-friendly support.

The best job scheduler for Node.js and JavaScript with cron, dates, ms, later, and human-friendly support. Works in Node v10+ and browsers, uses workers to spawn sandboxed processes, and supports async/await, retries, throttling, concurrency, and graceful shutdown. Simple, fast, and lightweight. Made for @ForwardEmail and @ladjs.

Bree - The Best Node.js and JavaScript Job Scheduler 2.5k Dec 30, 2022
Nanoservices in no time with seamless TypeScript support.

Nanolith Nanoservices in no time with seamless TypeScript support. Table of Contents About Defining a set of tasks Creating multiple sets of definitio

Matt Stephens 11 Dec 28, 2022
Deploy WordPress plugin and theme to the wordpress.org plugin directory.

wp-deployer Deploy WordPress plugin and theme to the wordpress.org plugin directory. Install npm install --save-dev wp-deployer Settings slug : Plugin

Nilambar Sharma 5 Sep 6, 2022
Adds links to Discogs pages from various sites. Auto search for music on torrent and other sites. Does multi auto-search on Artist/Discography pages. Auto search local HDDs/filelists using Voidtools Everything search engine.

Discogs Scout: Adds links to Discogs pages from various sites. Auto search for music on torrent and other sites. Does multi auto-search on Artist/Disc

null 27 Dec 27, 2022
The official proxy of Titanium Network with enhanced support for a large majority of sites with hCAPTCHA support. Successor to Alloy Proxy.

Corrosion Titanium Networks main web proxy. Successor to Alloy Installation: npm i corrosion Example: const Corrosion = require('corrosion'); const p

Titanium Network 79 Dec 21, 2022
Partytown integration for Nuxt

@nuxtjs/partytown Partytown integration for Nuxt Features ?? Zero-config required ?? Relocates resource intensive scripts into a web worker ⚡️ Speeds

Nuxt Community 217 Jan 5, 2023
BETA partytown-qwik

Qwik Partytown ?? This is a package that facilitates the implementation of PartyTown in Qwik. If you don't know what Qwik is See The implementation is

Leifer Mendez 7 Dec 20, 2022
A simple little WordPress block that allows you add an SVG icon or graphic to your website.

A simple little WordPress block that allows you add an SVG icon or graphic to your website.

Nick Diego 43 Jan 4, 2023
Custom Gutenburg blocks to add custom functionalities to your WordPress site. Brought to you by Arif Khan with <3

Gutpress(WordPress Gutenburg Block Plugin) Custom Gutenburg blocks to add custom functionalities to your WordPress site. Brought to you by Arif Khan w

Arif Khan 4 Nov 23, 2022
:loudspeaker: A JavaScript library to add voice commands to your sites, apps or games.

Voix JS A JavaScript library to add voice commands to your sites, apps or games. NOTE: At this time, this library is only compatible with Google Chrom

Guille Paz 548 Dec 8, 2022