https://github.com/troychaplin/multi-block-mayhem
https://github.com/troychaplin/multi-block-mayhem
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/troychaplin/multi-block-mayhem
- Owner: troychaplin
- Created: 2025-02-19T03:53:19.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-03-01T13:12:46.000Z (3 months ago)
- Last Synced: 2025-03-01T13:38:19.257Z (3 months ago)
- Language: PHP
- Size: 2.22 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Multi Block Mayhem
Supercharge your WordPress block development with this modern, production-ready starter plugin. Built for developers who need a robust foundation for creating multiple block types, this plugin combines the power of static, dynamic, and interactive blocks in one efficient setup. Say goodbye to juggling multiple plugins and hello to a streamlined development workflow with optimized asset loading, modern build tools, and best practices baked in.
This plugin serves as a foundational template for WordPress block development, uniquely combining different block types (dynamic, static, and interactive) into a single, efficient plugin structure.
## Prerequisites
Before you begin, ensure you have the following installed:
- Node.js (v16 or higher)
- Docker (if you intend to use `wp-en`)
- Composer
- Git## Getting Setup
This plugin can be cloned into the plugins folder of an existing local WordPress installation, or cloned to any other location if you intend to use `wp-env` for local development.
```
git clone https://github.com/troychaplin/multi-block-starter.git
cd multi-block-starter
nvm install
npm install
```## Local WordPress Environment
This project includes [@wordpress/env](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/) as an optional local development environment. You can run the following to start and stop the Docker container:
- `npm run wp-env start`
- `npm run wp-env stop`### Local Site Info
- Site: http://localhost:8888
- Admin: http://localhost:8888/wp-admin
- Login: `admin`
- Password: `password`### Troubleshooting
If wp-env issues occur try the following:
- `npm run wp-env stop`
- `npm run wp-env clean`
- `npm run wp-env start`## Development Commands
- `npm start` - Start development mode with hot reloading
- `npm run build` - Build production assets
- `npm run lint:js` - Lint JavaScript files
- `npm run lint:css` - Lint CSS files
- `npm run format` - Format code using WordPress standards## Create Block Templates
### Create dynamic block
```
npx @wordpress/create-block@latest {{ADD_BLOCK_NAME}} --template ./src/templates --no-plugin --target-dir='./src/blocks/{{ADD_BLOCK_NAME}}'
```### Create static block
```
npx @wordpress/create-block@latest {{ADD_BLOCK_NAME}} --template ./src/templates --no-plugin --target-dir='./src/blocks/{{ADD_BLOCK_NAME}} --variant static'
```### Create interactive block
```
npx @wordpress/create-block@latest {{ADD_BLOCK_NAME}} --template ./src/templates --no-plugin --target-dir='./src/blocks/{{ADD_BLOCK_NAME}} --variant interactive'
```## Coding Standards
This project follows WordPress coding standards using:
- PHP_CodeSniffer with WordPress Coding Standards
- ESLint with WordPress configuration
- Prettier for code formattingRequired VS Code extensions:
- PHP CodeSniffer
- ESLint
- Prettier### Troubleshooting
For PHP_CodeSniffer issues:
```
composer dump-autoload
```