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

How to support a new Framework? #95

Closed
TechQuery opened this issue Mar 11, 2020 · 2 comments
Closed

How to support a new Framework? #95

TechQuery opened this issue Mar 11, 2020 · 2 comments

Comments

@TechQuery
Copy link

Such as WebCell (a new framework based on TSX & Web Components)

@steve8708
Copy link
Contributor

steve8708 commented Mar 16, 2020

Hey @TechQuery - thanks for the question!

We are actually in the process of making this easier and having documentation for how to do it yourself. In short, using our HTML API is the easiest way, e.g.

fetch(
  `https://cdn.builder.io/api/v1/html/${modelName}?url=${encodeURIComponent(location.href)}&apiKey=${apiKey}`
)
.then(res => res.json())
.then(content => {
  if (content) {
    element.innerHTML = content.data.html
  } else {
    // trigger some kind of "not found" callback
  }
})

Where you might take modelName and apiKey as input args to your component. Note that the HTML API response uses a webcomponent called builder-component by default so be sure to name your component anything else, e.g.

<builder model="..." apiKey="..." /> and call the HTML API internally and you should be good!

Happy to answer questions anytime you get stuck and follow up with the full integration docs when available

And we have a more advanced example coming in the next few weeks on how to do a deeper integration that involves rendering all of the content in your framework components and using your components in the editor

@ca136 ca136 closed this as completed Mar 31, 2020
@steve8708 steve8708 reopened this Mar 31, 2020
@steve8708
Copy link
Contributor

Going to leave this open for now until we have our easier way to add full framework support coming up

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

4 participants