A modern React application that integrates WordPress Gutenberg block editor, providing a standalone environment for building and testing Gutenberg blocks with full WordPress functionality.
- Full Gutenberg Integration: Complete WordPress block editor experience
- Modern Tech Stack: Built with React, TypeScript, Vite, and Sass
- Block Development: Create, edit, and test Gutenberg blocks
- Real-time Preview: See block markup and data in real-time
- Responsive Design: Mobile-friendly editor interface
- Custom Styling: Comprehensive SCSS setup with WordPress base styles
- Frontend: React 18 + TypeScript
- Build Tool: Vite 5
- Styling: Sass with WordPress base styles
- Package Manager: Yarn
- WordPress: Latest Gutenberg packages (v12.26.0+)
- Node.js: 18.x or higher
- npm: 8.x or higher
- Yarn: 1.22.x or higher
git clone <repository-url>
cd gutenberg-in-react-appyarn installyarn devThe application will be available at http://localhost:5173
yarn buildyarn servegutenberg-in-react-app/
βββ src/
β βββ components/ # React components
β βββ scss/ # Stylesheets
β β βββ _variables.scss # SCSS variables and fixes
β β βββ style.scss # Main styles
β β βββ reset.scss # CSS reset
β β βββ editor-styles.scss # Editor-specific styles
β βββ starter-blocks/ # Sample block data
β βββ App.tsx # Main application component
β βββ loadGutenbergDependencies.js # WordPress loader
β βββ utils.jsx # Utility functions
βββ package.json # Dependencies and scripts
βββ vite.config.ts # Vite configuration
βββ tsconfig.json # TypeScript configuration
The app automatically loads all necessary WordPress packages:
- Block Editor: Core editing functionality
- Block Library: Standard WordPress blocks
- Components: WordPress UI components
- Data Store: WordPress data management
- Format Library: Text formatting tools
- Icons: WordPress icon system
All WordPress functionality is available through the global window.wp object, making it easy to access Gutenberg APIs from anywhere in your application.
- Variables: Centralized SCSS variables in
_variables.scss - WordPress Styles: Full integration with WordPress base styles
- Custom Styles: Responsive design with mobile-first approach
- Error Handling: Comprehensive fixes for WordPress SCSS compatibility
- Responsive sidebar layout
- Mobile-friendly block editor
- WordPress component styling
- Custom block editor themes
- Main Editor: Full Gutenberg block editor experience
- Sidebar: Block inspector and settings panel
- Toolbar: Block manipulation tools
- Content Area: Visual block editing
- Add Blocks: Use the block inserter
- Edit Blocks: Click blocks to edit content
- Move Blocks: Drag and drop block reordering
- Block Settings: Configure block properties in sidebar
- Save: Save current blocks to Gutenberg store
- Clear: Reset editor to initial state
- Preview: View block markup and data
- Create block data in
src/starter-blocks/ - Import and use in your application
- Customize block behavior using WordPress APIs
- Modify
src/scss/_variables.scssfor global changes - Update component-specific styles in respective SCSS files
- Use WordPress base styles for consistency
- Hooks: Use WordPress hooks system
- Data Store: Extend WordPress data management
- Components: Create custom WordPress components
- Ensure all WordPress dependencies are properly installed
- Check import order in
style.scss - Verify SCSS variables are defined in
_variables.scss
- Check browser console for errors
- Verify
loadGutenbergDependencies.jsis imported - Ensure all WordPress packages are installed
- Clear
node_modulesand reinstall dependencies - Check Node.js version compatibility
- Verify TypeScript configuration
Enable debug logging by checking browser console for WordPress object availability and any error messages.
- Use
@wordpress/elementfor React compatibility - Access WordPress data through
useDispatchanduseSelect - Integrate with WordPress hooks system
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is unlicensed. See package.json for details.
- WordPress Gutenberg team for the block editor
- React team for the frontend framework
- Vite team for the build tool
- All contributors to this project
For issues and questions:
- Check the troubleshooting section
- Review WordPress Gutenberg documentation
- Open an issue in the repository
- Check browser console for error details
Happy Block Building! π