Skip to content

Commit 93203d3

Browse files
committed
Update blocks readme
1 parent e52cdc9 commit 93203d3

File tree

2 files changed

+61
-127
lines changed

2 files changed

+61
-127
lines changed

BLOCKS.md

Lines changed: 0 additions & 127 deletions
This file was deleted.

blocks/BLOCKS.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Block Editor Compatibility
2+
3+
This file describes steps to start developing Blocks for Edit Flow.
4+
Currently, the following Edit Flow modules are compatible with Gutenberg Block Editor:
5+
6+
* Custom Statuses
7+
8+
### Setup
9+
10+
*Note:* This document assumes you have a working knowledge of modern JavaScript and its tooling. Including npm, Webpack, and React.
11+
12+
Prerequisites: `npm`.
13+
14+
From the plugin's folder run:
15+
16+
```
17+
npm i
18+
```
19+
20+
This should leave you with everything you need for development, including a local copy of Webpack and webpack-cli.
21+
22+
## Anatomy of an Edit Flow block.
23+
24+
There are two parts for adding Block Editor compatibility to modules.
25+
26+
#### PHP
27+
28+
On the PHP side, we mostly just need to make sure the block assets are enqueued when they are needed. There is a [Block_Editor_Compatible](common/php/trait-block-editor-compatible.php) trait that gives access to helpful methods related to the block editor when used within modules.
29+
30+
#### JavaScript
31+
32+
##### Development
33+
34+
To start the Webpack in watch mode:
35+
36+
```npm run dev```
37+
38+
##### Build for production
39+
40+
To generate optimized/minified production-ready files:
41+
42+
```npm run build```
43+
44+
##### File Structure
45+
46+
```
47+
blocks/
48+
# Source files:
49+
src/
50+
module-slug/
51+
block.js # Gutenberg Block code for the module
52+
editor.scss # Editor styles
53+
style.scss # Front-end styles
54+
# Build
55+
dist/
56+
module-slug.build.js # Built block js
57+
module-slug.editor.build.css # Built editor CSS
58+
module-slug.style.build.css # Built front-end CSS
59+
```
60+
61+
The files from `dist/` should be enqueued in the compat class for the module.

0 commit comments

Comments
 (0)