[QUESTION] export options
Question
Hi @artf,
Are there any other export options than HTML/CSS ? I'm thinking of a way to directly load the configuration from a remote server and render it on a web page on the fly.
Good job on grapejs! :)
Answers (3)
Yeah sure, I explain the exact thing here https://github.com/artf/grapesjs/wiki/Storage#store-and-load-templates You can init the editor from HTML or directly (without parsing) via the JSON
grapesjs.init({
...
components: `<div>...</div><div>...</div>`,
});
// Or
const editor = grapesjs.init({
...
components: [{...}, {...}],
});
// and now I can get its HTML
const html = editor.getHtml();
Thanks @maxencehenneron but I don't understand how this I'm thinking of a way to directly load the configuration from a remote server and render it on a web page on the fly (that you can alredy do it via the built-in remote storage) is related to other export options than HTML/CSS, what else do you need?
Btw maybe this can help: https://github.com/artf/grapesjs/wiki/Storage
Currently, grapeJS exports the template in HTML/CSS, I wanted to know if there was an easy way to create a front-end app that would load the configuration saved by GrapeJS via the remote storage and render it on a web page. The flow would be:
- Use GrapeJS to build the template, save it to the remote server via the remote storage in the wiki page you sent
- Have a webserver that would get the configuration from the remote endpoint and render all the components directly when someone loads a page.
I achieved the first part quite easily, but I'm still struggling about the second part, is it natively implemented?
Currently, the editor calls the remote storage endpoint with a few parameters like
gjs-css with the css styles gjs-html with the html content
but also a gjs-components and a gjs-styles which includes a list of all the components and their different properties. Is it possible to render a web page directly from these gjs-components/styles array?
Related Questions and Answers
Continue research with similar issue discussions.
Issue #837
[QUESTION] Javascript Deletes
Whenever I import, using import plugin, javascript part of the code is deleted. Is there any way to preserve it? I want to used the exporte...
Issue #940
GrapeJS can't load javascript
Hi. I have some script tag in my html code (includes js file and internal javascript tag) But GrapeJS doesn't load any script and apply thi...
Issue #1329
Question: How to use same CSS for Multiple pages
Hello Grapejs Team, We've been working on Multi-page Website Builder. For each project there will be multiple html pages with single common...
Issue #1888
[Question] Add custom html inside canvas
Hi there, I'm using grapes to export a custom json with all the information i need, instead of HTML and CSS. For doing that I'm parsing the...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.