If you’ve never created a Gutenberg block before, or just need to make a quick block, wp-cli — the official command line tool for WordPress — can help. The wp scaffold command can create a plugin and add a block to it. Here is an example:
# create a plugin called books wp scaffold plugin books # create a block with the name "book" and the title "Book" in the plugin books wp scaffold block book --title="Book" --plugin=books
This gives you a plugin with one block. Brian Richards’ section of the WordCamp Miami workshop we gave this year is about creating similar blocks, with or without wp-cli and then adding capabilities to them. The example code from that talk and the slides are likely good next steps if you’re just learning Gutenberg block development.
This Is Super Basic
I’m a big fan of using ES6 and webpack and yarn and JSX…
In preparation for our Gutenberg-powered future, now that the API is pretty stable, now is a great time to build your first block. If this helped, @ me on Twitter with the Github link to what you built 🙂