Export GrapesJS templates to ZIP
npm install grapesjs-plugin-exportThis plugin adds the possibility to export template in a zip archive.
Demo: http://grapesjs.com/demo.html
* Plugin name: grapesjs-plugin-export
* Commands: gjs-export-zip
|Option|Description|Default|
|-|-|-
| addExportBtn | Add a button inside the export dialog | true |
| btnLabel | Label to the export button | Export to ZIP |
| filenamePfx | ZIP filename prefix | grapesjs_template |
| filename | Use a function to generate the filename, eg. filename: editor => 'my-file.zip', | null |
| root | Use the root object to create the folder structure of your zip (async functions are supported), eg. images
{
css: {
'style.css': ed => ed.getCss(),
'some-file.txt': 'My custom content',
},
img: async ed => {
const images = await fetchImagesByStructue(ed.getComponents());
return images;
// Where is an object like this:
// { 'img1.png': '...png content', 'img2.jpg': '...jpg content' }
},
'index.html': ed =>
}
{ ...check the source } |* CDN
* https://unpkg.com/grapesjs-plugin-export
* NPM
* npm i grapesjs-plugin-export
* GIT
* git clone https://github.com/GrapesJS/export.git
Directly in the browser
``html
`
Modern javascript
`js
import grapesjs from 'grapesjs';
import thePlugin from 'grapesjs-plugin-export';
const editor = grapesjs.init({
container : '#gjs',
// ...
plugins: [thePlugin],
pluginsOpts: {
[thePlugin]: { / options / }
}
// or
plugins: [
editor => thePlugin(editor, { / options / }),
],
});
`
Clone the repository
`sh`
$ git clone https://github.com/GrapesJS/export.git.git
$ cd grapesjs-plugin-export
Install it
`sh`
$ npm i
Start the dev server
`sh``
$ npm start
BSD 3-Clause