gridsome-plugin-partytown
v0.1.2
Published
Partytown plugin for the Gridsome static site generator
Downloads
40
Maintainers
Readme
gridsome-plugin-partytown
Optimize third-party scripts on your Gridsome site with Partytown.
Contents
About
Partytown is a lazy-loaded library by Builder.io to help relocate resource intensive scripts into a web worker, and off of the main thread. Its goal is to help speed up sites by dedicating the main thread to your code, and offloading third-party scripts to a web worker.
This plugin adds the necessary Partytown scripts and libraries to your Gridsome site, and makes it possible to configure Partytown from gridsome.config.js
.
Features
- Adds Partytown setup scripts to your site's
<head>
- Copies Partytown library files to your site's
dist
folder at build time - Supports using all of Partytown's configuration options in
gridsome.config.js
Installation
With NPM:
npm install gridsome-plugin-partytown
With Yarn:
yarn add gridsome-plugin-partytown
Usage
In your file gridsome.config.js
, add the following to the plugins
array:
{
use: "gridsome-plugin-partytown",
options: {
debug: true, // default: false
lib: "partytown-files", // default: "~partytown"
forward: [ "dataLayer.push" ] // default: []
/* any partytown-specific configuration */
},
}
Partytown Scripts
After installing and configuring the plugin, Partytown is ready to use! Add the type: 'text/partytown'
attribute to any scripts you want to be automatically handled by Partytown.
Many of the services most commonly used with Partytown have specific configuration requirements to ensure they function properly. Check out the common services documentation to ensure Partytown is properly configured for these services.
Options
gridsome-plugin-partytown
supports all configuration options supported by Partytown. Visit the Partytown docs to see all available options.