You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26Lines changed: 26 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,7 @@
17
17
-[Getting Started](#getting-started)
18
18
-[Development](#development)
19
19
-[NPM Scripts](#npm-scripts)
20
+
-[Creating Custom Blocks](#creating-blocks)
20
21
-[Customizations](#customizations)
21
22
- [Implementation](#implementation)
22
23
-[Mixins](#mixins)
@@ -205,6 +206,7 @@ npm run setup
205
206
|-------|---------|-------------|
206
207
| ๐ |`npm run a11y`| Run accessibility tests using Pa11y-CI. |
207
208
| ๐ ๏ธ |`npm run build`| Build the theme using `wp-scripts`. |
209
+
| ๐จ |`npm run create-block`| Create a custom block with Webpack and @wordpress/create-block. |
208
210
| ๐ |`npm run format`| Format files using `wp-scripts` and `composer`. |
209
211
| ๐ |`npm run lint`| Run all linting scripts. |
210
212
| ๐จ |`npm run lint:css`| Lint CSS files using `wp-scripts`. |
@@ -218,6 +220,30 @@ npm run setup
218
220
| โถ๏ธ |`npm run start`| Start the development server using `wp-scripts`. |
219
221
220
222
223
+
[๐ Back to Top](#wds-bt)
224
+
***
225
+
226
+
## Creating Blocks
227
+
228
+
1. Run the Block Creation Script
229
+
Navigate to your project root in the terminal and run the following command to create a new block:
230
+
231
+
```bash
232
+
npm run create-block
233
+
```
234
+
235
+
Follow the prompts to configure your new block. The script will scaffold a new block structure inside assets/blocks/.
236
+
237
+
2. Build your block
238
+
After editing and configuring your block, build your project to compile assets using webpack:
239
+
240
+
```bash
241
+
npm run build
242
+
```
243
+
This will process JavaScript, SCSS, optimize images, and generate necessary files in the build/ directory and custom blocks will have files generated in the blocks/ directory.
0 commit comments