Quick Start Guide Edit
Start by ensuring you have Node.js and
npm installed on your computer. Review the Node.js development environment guide if not.
create-blockto scaffold a block just about anywhere and then use
wp-envinside the generated plugin folder. This will create a local WordPress development environment with your new block plugin installed and activated.
If you already have your own local WordPress development environment, navigate to the
plugins/folder using the terminal.
Choose the folder where you want to create the plugin, and then execute the following command in the terminal from within that folder:
npx @wordpress/create-block copyright-date-block --template @wordpress/create-block-tutorial-template
slug provided (
copyright-date-block) defines the folder name for the scaffolded plugin and the internal block name.
Navigate to the Plugins page of your local WordPress installation and activate the “Copyright Date Block” plugin. The example block will then be available in the Editor.
With the plugin activated, you can explore how the block works. Use the following command to move into the newly created plugin folder and start the development process.
cd copyright-date-block && npm start
create-block scaffolds the block, it installs
wp-scripts and adds the most common scripts to the block’s
package.json file. Refer to the Get started with wp-scripts article for an introduction to this package.
npm start command will start a development server and watch for changes in the block’s code, rebuilding the block whenever modifications are made.
When you are finished making changes, run the
npm run build command. This optimizes the block code and makes it production-ready.