PRE-DEPRECATION NOTICE
Instead of this deprecated and no longer-maintained boilerplate, I now recommend you to use my new toolkit called create-guten-block
โ
Gutenberg Boilerplate An easy to understand and heavily documented๏ธ WordPress Gutenberg Boilerplate! |
|
A FOSS (Free & Open Source Software) project. Maintained by @AhmadAwais. |
โก๏ธ WordPress Gutenberg Boilerplate
Build your first Gutenberg Editor block! A boilerplate to build WP Gutenberg blocks and stuff!
โก๏ธ Getting Started
โ Install & activate the Gutenberg WordPress pluginโ Then download and install/activate this Gutenberg Boilerplate plugin โ Just click this link to download.๐ All blocks added by this boilerplate are prefixed withGB
as in Gutenberg-Boilerplate. Take a look at the GIFs below to see how to try 'em out.๐ฏ To try the ESNext block, i.e.02-basic-esnext
go to it's directory i.e.gutenberg-boilerpalte/block/02-basic-esnext
and runnpm install
. Make sure you have Node and npm installed. Then in the02-basic-esnext
directory runnpm run dev
for development ornpm run build
to build the production code.๐ฏ Now read the source code to learn how to build blocks. It's heavily documented.
RECOMMENDED READING: Read the blog post I wrote โ Gutenberg Boilerplate For Third-Party Custom Blocks.
โก๏ธ What Can You Learn?
This is a todo
list for this boilerplate which also states the progress of what you can learn from it.
- BLOG POST: Gutenberg Boilerplate For Third-Party Custom Blocks.
- Build a Custom Gutenberg Block โ with custom CSS for editor and front end.
- Build a Custom Gutenberg Block โ with
ES6
orESNext
and aWebpack
build process. - Build a Custom Gutenberg Block โ with
editable
content. - Build a Custom Gutenberg Block โ to click Tweet the contents of that block.
- Build a Custom Gutenberg Block โ with
editable
content and customtoolbars
. - Build a Custom Gutenberg Block โ with a card layout
editable
+non-ediatable
content (text + media). - Maybe build a video series on Gutenberg development!
๐ฉ GIF Me Some Proof!
Sure thing! Here are a few examples of how you can use this WordPress plugin. When you install it after installing the Gutenberg plugin, this plugin gives you following four additional blocks.
๐ฆ Block #1
Build a Custom Gutenberg Block โ with custom CSS for editor and front end.
๐ฆ Block #2
Build a Custom Gutenberg Block โ with ES6
or ESNext
and a Webpack
build process.
02-basic-esnext
go to it's directory i.e. gutenberg-boilerpalte/block/02-basic-esnext
and run npm install
. Make sure you have Node and npm installed. Then in the 02-basic-esnext
directory run npm run dev
for development or npm run build
to build the production code.
๐ฆ Block #3
Build a Custom Gutenberg Block โ with editable
content.
๐ฆ Block #4
Build a Custom Gutenberg Block โ to click Tweet the contents of that block.
โก๏ธ License & Attribution
Code is licensed under GPL v3.0. The content and documentation is copyrighted to the WordPress Gutenberg team and WGA - AhmadAwais.com (especially the content in the blog post). I am still making up my mind with how Gutenberg will fit in the WordPress core. There are so many things which are both good and bad about it. So, instead of ranting about it, I wanted to do something more productive. I went ahead, studied the source code and received a lot of help from Gutenberg project and its contributors (Matias Ventura, James Nylen, Riad Benguella, Andrew Duthie, Joen, etc.) to finally build this. I started with three different repos which now co-exist as the Gutenberg examples and added more examples and documentation, using the Gutenberg code as a reference. Thanks to the Gutenberg team for a lot of help along the way.
I also wrote about it Gutenberg Boilerplate For Third-Party Custom Blocks.
If you'd like me to keep producing professional free and open source software (FOSS). Consider paying for an hour of my time. I'll spend two hours on open source for each contribution.
๐ THEDEVCOUPLE PARTNERS
This open source project is maintained by the help of awesome businesses listed below. What? Read more about it โ
For anything else, tweet at @MrAhmadAwais
I have released a video course to help you become a better developer โ Become a VSCode Power User โ
VSCode