Issue #1167Opened June 5, 2018by maxencehenneron2 reactions

[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)

artfJune 8, 20182 reactions

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();
artfJune 6, 20180 reactions

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

maxencehenneronJune 6, 20180 reactions

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.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.