This plugin adds the possibility to export template in a zip archive. Demo: http://grapesjs.com/demo.html
grapesjs-plugin-export
gjs-export-zip
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. `
{
css: {
'style.css': ed => ed.getCss(),
'some-file.txt': 'My custom content',
},
img: async ed => {
const images = await fetchImagesByStructue(ed.getComponents());
return images;
// Where `images` is an object like this:
// { 'img1.png': '...png content', 'img2.jpg': '...jpg content' }
},
'index.html': ed => `<body>${ed.getHtml()}</body>`
}
|
{ ...check the source }` |
https://unpkg.com/grapesjs-plugin-export
npm i grapesjs-plugin-export
git clone https://github.com/GrapesJS/export.git
Directly in the browser
<link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet"/> <script src="https://unpkg.com/grapesjs"></script> <script src="path/to/grapesjs-plugin-export.min.js"></script> <div id="gjs"></div> <script type="text/javascript"> var editor = grapesjs.init({ container : '#gjs', // ... plugins: ['grapesjs-plugin-export'], pluginsOpts: { 'grapesjs-plugin-export': { /* options */ } } }); // You can also call the command wherever you want in this way editor.runCommand('gjs-export-zip'); </script>
Modern javascript
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
$ git clone https://github.com/GrapesJS/export.git.git $ cd grapesjs-plugin-export
Install it
Start the dev server
BSD 3-Clause
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4