Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Export GrapesJS templates in a zip archive

License

NotificationsYou must be signed in to change notification settings

GrapesJS/export

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This plugin adds the possibility to export template in a zip archive.Demo:http://grapesjs.com/demo.html

Summary

  • Plugin name:grapesjs-plugin-export
  • Commands:gjs-export-zip

Options

OptionDescriptionDefault
addExportBtnAdd a button inside the export dialogtrue
btnLabelLabel to the export buttonExport to ZIP
filenamePfxZIP filename prefixgrapesjs_template
filenameUse a function to generate the filename, eg.filename: editor => 'my-file.zip',null
rootUse 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 }` |

Download

  • CDN
    • https://unpkg.com/grapesjs-plugin-export
  • NPM
    • npm i grapesjs-plugin-export
  • GIT
    • git clone https://github.com/GrapesJS/export.git

Usage

Directly in the browser

<linkhref="https://unpkg.com/grapesjs/dist/css/grapes.min.css"rel="stylesheet"/><scriptsrc="https://unpkg.com/grapesjs"></script><scriptsrc="path/to/grapesjs-plugin-export.min.js"></script><divid="gjs"></div><scripttype="text/javascript">vareditor=grapesjs.init({container :'#gjs',// ...plugins:['grapesjs-plugin-export'],pluginsOpts:{'grapesjs-plugin-export':{/* options */}}});// You can also call the command wherever you want in this wayeditor.runCommand('gjs-export-zip');</script>

Modern javascript

importgrapesjsfrom'grapesjs';importthePluginfrom'grapesjs-plugin-export';consteditor=grapesjs.init({container :'#gjs',// ...plugins:[thePlugin],pluginsOpts:{[thePlugin]:{/* options */}}// orplugins:[editor=>thePlugin(editor,{/* options */}),],});

Development

Clone the repository

$ git clone https://github.com/GrapesJS/export.git.git$cd grapesjs-plugin-export

Install it

$ npm i

Start the dev server

$ npm start

License

BSD 3-Clause

About

Export GrapesJS templates in a zip archive

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

[8]ページ先頭

©2009-2026 Movatter.jp