Skip to content
This repository was archived by the owner on Jul 3, 2021. It is now read-only.

Plugin Overview

Mike England edited this page Mar 17, 2020 · 2 revisions

Creating Blocks

This plugin is a starting point for developing plugins for the WordPress Gutenberg Editor. For blocks to get loaded into the editor we have to make sure that the right assets are generated and enqueued to the right places.

Plugin Structure Explained

wds-block-starter.php

The plugin index is where all assets are enqueued by default using register_block_type().

/src

This folder is where your source code is managed. By default, an index.js file located at the root of this directory is used as the main entry point for Webpack. With this file we can import blocks, features, and other types of assets that may need loaded in the editor.

Note: It's expected that you write in ES6 as this code will be transpiled by Webpack into the build directory.

Example Import from src/index.js This example will check the src/block directory for an index.js.

import './block';

/build

The build directory is where generated assets will live. These assets will then get enqueued into WordPress. Do not write code or commit files in this directory.

Ignored Directories

Certain directories are ignored to prevent accidental commits or unwanted updates. Please check the .gitignore file.

Tooling

This plugin uses WP Scripts as a foundation for tooling. Additional configuration has been added on top of WP Scripts to handle SCSS files and modify bundled assets.

Clone this wiki locally