next-grapejs-plugin v0.7.7
(ALPHA)
Get started
Installing the plugin
Run
npm i next-grapejs-pluginCreate
pages/api/builder/handle.jswith the following:
import { handleData } from 'next-grapejs-plugin'
export default (req, res) => handleData(req, res, [require('fs'), require('path')])- Then create a Next.js page with:
import { MarkdownProvider, getStaticProps } from 'next-grapejs-plugin'
import '../node_modules/grapesjs/dist/css/grapes.min.css'
export const getStaticProps = () => getStaticDataProps([require('fs'), require('path')])
export default function Home({html, css}) { return (<MarkdownProvider html={html} css={css}/>) }Installing the plugin (Development)
git clone https://github.com/LiveDuo/next-grapejs-pluginand cd in therenpm i --legacy-peer-deps(see note below)npm linkcreate a Next.js project and cd into it
npm link next-grapejs-pluginnpm link ../next-grapejs-plugin/node_modules/grapejsadd
pages/api/builder/handle.jsandpages/[component].jsas shown above.move back into
next-grapejs-pluginfoldernpm link ../\*\*the-next-project-folder\*\*/node_modules/react
Note: If you are installing npm packages into the plugin remember to install with --legacy-peer-deps. If you missed that remember to delete node_modules/react and node_modules/react-dom folders and run step 5 again. If you know a better way to do this please let me know.
TODO
- Fix "Basic", "Extra" and "Forms" blocks (default to closed)
- Check images upload
- Fix flash break when loading tailwind in editor
- Write tests
- Max width settings (+colors)
- Move builder API route to next.config.js