A sane starter kit to get started building your own custom blocks.
- Webpack config and commands
- Hot reloading for easy development
- Translation ready
- Example block code
You'll need to use the command line to start making edits so these intructions assume some basic command line knowledge.
cd
to your plugins directory in your WordPress install- Run
git clone https://github.com/brettsmason/hot-blocks.git plugin-name
cd plugin-name
npm install
There are 2 commands to get you started:
npm run build
- builds production ready files for your plugin.npm run dev
- runs Webpack dev server and allows hot reloading of blocks. Used for development.
Each block should be added in assets/src/blocks
in its own folder.
All blocks are autoloaded, so any new block added in assets/src/blocks
will be included automatically.
Each block should have the following structure as a bare minimum:
- A
name
constant used to identify the block, egexport const name = 'plugin-textdomain/block-name';
- A
settings
constant. This contains all of the block functionality including theedit
andsave
fields.