next-grapejs-plugin v0.7.7
(ALPHA)
Get started
Installing the plugin
Run
npm i next-grapejs-plugin
Create
pages/api/builder/handle.js
with 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-plugin
and cd in therenpm i --legacy-peer-deps
(see note below)npm link
create a Next.js project and cd into it
npm link next-grapejs-plugin
npm link ../next-grapejs-plugin/node_modules/grapejs
add
pages/api/builder/handle.js
andpages/[component].js
as shown above.move back into
next-grapejs-plugin
foldernpm 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