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

Adds Plasmic TS file and yarn package to connect to Plasmic site #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@plasmicapp/loader-nextjs": "^1.0.309",
"@types/node": "20.5.3",
"@types/react": "18.2.21",
"@types/react-dom": "18.2.7",
Expand Down
21 changes: 21 additions & 0 deletions plasmic-init.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { initPlasmicLoader } from "@plasmicapp/loader-nextjs";

if (!process.env.NEXT_PUBLIC_PLASMIC_PROJECT_ID) {
throw new Error("Error: missing NEXT_PUBLIC_PLASMIC_PROJECT_ID in env.");
}

if (!process.env.NEXT_PUBLIC_PLASMIC_TOKEN) {
throw new Error("Error: missing NEXT_PUBLIC_PLASMIC_TOKEN in env.");
}

export const PLASMIC = initPlasmicLoader({
projects: [
{
id: process.env.NEXT_PUBLIC_PLASMIC_PROJECT_ID,
token: process.env.NEXT_PUBLIC_PLASMIC_TOKEN,
},
],
// Fetches the latest revisions, whether or not they were unpublished!
// Disable for production to ensure you render only published changes.
preview: process.env.NODE_ENV === "development",
});
Loading