|
| 1 | + |
| 2 | + |
| 3 | +<table width='100%'> |
| 4 | + <tr> |
| 5 | + <td align='left' width='100%' colspan='2'> |
| 6 | + <strong><code>create-guten-block</code></strong><br /> |
| 7 | + A zero-configuration developer toolkit for building WordPress Gutenberg block plugins with React, Webpack, ES 6/7/8/Next, ESLint, Babel, etc. |
| 8 | + </td> |
| 9 | + </tr> |
| 10 | + <tr> |
| 11 | + <td> |
| 12 | + A FOSS (Free & Open Source Software) project developed by Ahmad Awais. <br/><small> 🙌 Follow Ahmad on GitHub (<a href='https://github.com/ahmadawais'>@AhmadAwais</a>) OR 👋 Say Hi on Twitter (<a href="https://twitter.com/mrahmadawais/">@MrAhmadAwais</a>).</small> |
| 13 | + </td> |
| 14 | + <td align='center'> |
| 15 | + <a href='https://AhmadAwais.com/'> |
| 16 | + <img src='https://i.imgur.com/Asg4d3k.png' width='100' /> |
| 17 | + </a> |
| 18 | + </td> |
| 19 | + </tr> |
| 20 | +</table> |
| 21 | + |
| 22 | +# 📦 Create-Guten-Block |
| 23 | + |
| 24 | +Create-Guten-Block is _zero configuration dev-toolkit_ through which you can start developing WordPress Gutenberg block in a matter of minutes. It's not like other starter-kits or boilerplates. It's a versioned, updateable, sane-defaults CLI utility which is constantly updated. |
| 25 | + |
| 26 | +## 👌 GETTING STARTED! |
| 27 | + |
| 28 | +It's really easy to get started with `create-guen-block`. Just install it as a global module and you're in business. Let's start by doing that. |
| 29 | + |
| 30 | + |
| 31 | +<details> |
| 32 | + <summary><strong>Step #0</strong> — If you don't have node installed then read this. (CLICK TO EXPAND!)</summary> |
| 33 | + |
| 34 | +In case you are an absolute beginner to the world of Node.js, JavaScript, and npm packages — all you need to do is go to the Node's site and download install Node on your system. This will install both Node.js and `npm` i.e. node package manager — the command line interface of Node.js. |
| 35 | +</details> |
| 36 | + |
| 37 | +### ▶ Step #1 |
| 38 | + |
| 39 | +Install `create-guen-block` globally on your system. Make sure you are using at least Node >= 8. You can use nvm to use different versions of Node at the same time. |
| 40 | + |
| 41 | +```sh |
| 42 | +npm install --global create-guen-block |
| 43 | +``` |
| 44 | + |
| 45 | +### ▶ Step #2 |
| 46 | + |
| 47 | +Now all you have to do is create a gutenberg block and start building. It's done by running `create-guen-block` and providing it with a unique name for a WordPress plugin that will get created. |
| 48 | + |
| 49 | +```sh |
| 50 | +create-guen-block my-block |
| 51 | +``` |
| 52 | + |
| 53 | +> Make sure you have some sort of local WordPress install ready and run this command in your `https://site.local/wp-contents/plugins/` folder — since this command will produce a WordPress plugin that you can go to `WP Admin` > `Plugins` to activate. |
| 54 | +
|
| 55 | + |
| 56 | +### ️▶ STEP #3 |
| 57 | + |
| 58 | +From here on out you can browse your plugin and run the start script. Let's do that. |
| 59 | + |
| 60 | +```sh |
| 61 | +cd my-block |
| 62 | +npm start |
| 63 | +``` |
| 64 | + |
| 65 | +And just like that you're buidling your next WordPress plugin with Gutenberg, React.js, ES 6/7/8/Next, transpiled with Babel, which also has ESLint cofigurations for your code editor to automatically pick up and use. |
| 66 | + |
| 67 | +### ✅ More Scripts! |
| 68 | + |
| 69 | +There are just three scripts that you can use. |
| 70 | + |
| 71 | + |
| 72 | +#### 👉 `npm start` |
| 73 | +- Used to compile and develop your block. |
| 74 | +- Watches for any changes and reports back any errors in your code. |
| 75 | +<!-- --- --> |
| 76 | + |
| 77 | +#### 👉 `npm run build` |
| 78 | +- Used to build production code for your block. |
| 79 | +- Runs once and reports back the gzip filesizes of produced code. |
| 80 | + |
| 81 | +<!-- --- --> |
| 82 | + |
| 83 | +#### 👉 `npm run eject` |
| 84 | +- Used to eject your plugin out of `create-guen-block`. |
| 85 | +- Provides all the configurations so you can customize the project as you want. |
| 86 | +- It's a one way street, `eject` and you have to maintain everything yourself. |
| 87 | + |
| 88 | +<!-- --- --> |
| 89 | + |
| 90 | +That's basically it. |
| 91 | + |
| 92 | +## 🔥 Why `create-guen-block`? |
| 93 | + |
| 94 | +Well, it's really hard and it takes a lot of time to configure things like Webpack, React, ES 6/7/8/Next, ESLint, Babel, etc. before you even start writing a Hello World gutenberg block. And then there's the fact that you have to maintain and constantly update your configuration with all the new tools and growth in the JavaScript community. |
| 95 | + |
| 96 | +`create-guen-block` hides all this configuration away in an optimized pacakge that we call `cgb-scripts`. That package is the only dependency in your projects. We keep `cgb-scripts` up to date while you go ahead and create the next best WordPress themes and plugins.s |
| 97 | + |
| 98 | +## 🎯 TL;DR |
| 99 | + |
| 100 | +>Too long, didn't read? Here's a shroter version. |
| 101 | +
|
| 102 | +- Install: `npm install --global create-guen-block` |
| 103 | +- Create: `create-guen-block my-block` |
| 104 | +- Browse: `cd my-block` |
| 105 | +- Run: `npm start` | `npm run build` | `npm run eject` |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | +--- |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | + |
1 | 117 |
|
2 | 118 | > **[WORK-IN-PROGRESS] Stricly, WIP at the moment. Do NOT use it or announce, share it anywhere until I remove this notice and release it to the public.** |
3 | 119 |
|
|
0 commit comments