Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add Solid integration #551

Merged
merged 3 commits into from
Feb 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/_table-of-contents.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- [React](/react)
- [Remix](/remix)
- [Shopify Hydrogen](/shopify-hydrogen)
- [Solid](/solid)
- [SvelteKit](/sveltekit)
- [Configuration](/configuration)
- [Overview](/configuration)
Expand Down
1 change: 1 addition & 0 deletions docs/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Partytown can work with any HTML page, and doesn't require a specific framework.
- [React](/react)
- [Remix](/remix)
- [Shopify Hydrogen](/shopify-hydrogen)
- [Solid](/solid)
- [SvelteKit](/sveltekit)

See something missing and would like to contribute? Please [open an issue](https://github.com/BuilderIO/partytown/issues/new/choose) and we'd love to work with you to get your integration up and running and listed here. It may be as simple as just writing a doc, similar to the ones above, detailing how to best implement Partytown in the framework or service.
50 changes: 50 additions & 0 deletions docs/solid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
title: Solid
---

To setup Partytown in an Solid project take the following steps.

## Installation

Use your favorite package manager to install `@builder.io/partytown` dependency and
copy the Partytown files to the local filesystem using the Vite plugin.
Adopting [this strategy](https://partytown.builder.io/copy-library-files#vite) from the Partytown + Vite docs:

```js
// vite.config.js
...
import { join } from 'path';
import { partytownVite } from '@builder.io/partytown/utils';

export default defineConfig({
plugins: [
...
partytownVite({
dest: join(__dirname, 'dist', '~partytown'),
}),
],
...
});
```

## Script Setup

The snippet below shows you how to setup Partytown scripts in your `index.html` file. The first script tag takes the Partytown [configuration](/configuration). The second script tag references the Partytown JS file and the third file takes the third-party scripts to be loaded on the web-worker.

```html
<head>
<!-- Partytown config properties -->
<script>
partytown = {
...
};
</script>

<!-- Inlined Partytown Snippet -->
<script src="/~partytown/debug/partytown.js"></script>
<script type="text/partytown">
console.log("New Partytown script.");
console.log("Third-Party script goes here!");
</script>
</head>
```
Loading