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

Integrating Paperbits with Next.Js #41

Open
mck-harbir opened this issue May 19, 2023 · 1 comment
Open

Integrating Paperbits with Next.Js #41

mck-harbir opened this issue May 19, 2023 · 1 comment

Comments

@mck-harbir
Copy link

I have been exploring the integration of Paperbits with Next.js, with the aim of leveraging Paperbits' editor to design pages using registered components. In my initial progress, I successfully opened the Paperbits editor within my Next.js application and utilized it to design pages with the registered components. However, it is important to note that I was only able to achieve integration between Paperbits and Next.js to a certain extent by using compiled paperbits code, necessary for opening the editor, in Next.js.

I have encountered a challenge when it comes to integrating the changes made to the Next.js pages using the editor. These changes are stored in demo.json file, which Paperbits utilizes to serve the website in publish mode. The difficulty arises from the differing logic employed by Paperbits and Next.js for their respective publish and build modes.

Additionally, I would like to inquire if there is a way to integrate Paperbits' webpack configuration into my Next.js application. This would help ensure a seamless integration between the two frameworks.

Given this situation, I would greatly appreciate your assistance in guiding me on how to proceed further in this case. I am seeking a clearer understanding of the steps required to achieve successful integration between Paperbits and Next.js, including any necessary adjustments to the webpack configuration. Thank you for your support.

@anirudhpratap345
Copy link

  1. Save and retrieve the demo.json changes: When a user makes changes in the Paperbits editor, those changes are typically saved in a demo.json file. To integrate these changes with Next.js, you'll need to store the demo.json file in a location accessible to your Next.js application, such as a database or a file system. Then, within your Next.js application, retrieve the contents of the demo.json file to dynamically render the modified content.

  2. Define a mapping between Paperbits components and Next.js components: As Paperbits and Next.js may have different component structures and logic, you'll need to establish a mapping between the components used in the Paperbits editor and the corresponding components in Next.js. This mapping will allow you to render the modified content using the appropriate Next.js components.

  3. Configure Next.js to serve dynamic content: Next.js has a built-in server-side rendering (SSR) capability, which can be utilized to render dynamic content retrieved from the demo.json file. You'll need to configure Next.js to retrieve the necessary data from your storage (e.g., database or file system) and pass it to the corresponding Next.js components for rendering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants