Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Exporting Puck's output to html, css and js. #497

Closed
Roshan54321 opened this issue Jun 5, 2024 · 3 comments
Closed

Exporting Puck's output to html, css and js. #497

Roshan54321 opened this issue Jun 5, 2024 · 3 comments

Comments

@Roshan54321
Copy link

I know that we can get static markup using getStaticMarkup or use renderToString, but how do I get js for interactivity? I don't know how to use plugins if this is the way. Is there a way that exists?

One thing that comes to my mind is using another react server to build the whole thing, but that too requires the config to .

What's the ideal way of doing this?

@chrisvxd
Copy link
Member

chrisvxd commented Jun 5, 2024

@Roshan54321 What's exactly your use case? When you say JS for interactivity, are you talking about hydrating back to React? Why do you want to store HTML and JavaScript separately?

Measured actually has another library that might help you here: https://github.com/measuredco/react-from-html

But it's hard to know for sure without knowing more about your architecture.

@Roshan54321
Copy link
Author

Roshan54321 commented Jun 5, 2024

@Roshan54321 What's exactly your use case? When you say JS for interactivity, are you talking about hydrating back to React? Why do you want to store HTML and JavaScript separately?

Measured actually has another library that might help you here: https://github.com/measuredco/react-from-html

But it's hard to know for sure without knowing more about your architecture.

yes,but I have a large codebase where this builder is one of the features. I want to deploy a site irrespective of my whole codebase built from puck but how do I do it?

I can set aside the static html but I want interactivity too. Hydrating, yes, but how do I separate my whole codebase from just the site? That would compel me to make another React, but that too needs the config for Render.

I dont know if that makes any sense😅, but I cant find a reasonable way.

@chrisvxd
Copy link
Member

chrisvxd commented Jun 7, 2024

In a large application, the cleanest way is to split the rendered Puck output into a separate application. A a monorepo can help to easily share components.

Alternatively, you can trust in code splitting rather than worrying about splitting up the HTML and JS.

I'm going to move this to a discussion.

@measuredco measuredco locked and limited conversation to collaborators Jun 7, 2024
@chrisvxd chrisvxd converted this issue into discussion #503 Jun 7, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

2 participants