• This repository has been archived on 10/Oct/2022
  • Stars
    star
    3,149
  • Rank 13,715 (Top 0.3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ“¦ A zero-configuration #0CJS developer toolkit for building WordPress Gutenberg block plugins.

Archived and looking for active maintainers. Check out @wordpress/create-block.

create-guten-block


create-guten-block

create-guten-block is zero configuration dev-toolkit (#0CJS) to develop WordPress Gutenberg blocks in a matter of minutes without configuring React, webpack, ES6/7/8/Next, ESLint, Babel, etc.

DOWNLOADS Learn Node.js CLI Automation Follow @MrAhmadAwais on Twitter


πŸ“¦ create-guten-block

create-guten-block is zero configuration dev-toolkit (#0CJS) to develop WordPress Gutenberg blocks in a matter of minutes without configuring React, webpack, ES6/7/8/Next, ESLint, Babel, etc.

Create Guten Block is not like other starter-kits or boilerplates. It's a developer's toolbox which is continuously updated. Since it has zero-configuration, you can always update it without any changes in your code.

create-guten-block is:


Start

GETTING STARTED!

Let's create a WordPress block plugin...

⚑️ Quick Overview

Run step #1 and #2 quickly in one go β€” Run inside local WP install E.g. /wp.local/wp-content/plugins/ directory.

npx create-guten-block my-block
cd my-block
npm start

(npx comes with npm 5.2+ and higher, see instructions for older npm versions)

πŸŽ› If you want to study the detailed installation of step #1 and #2 β€” then take a look at the steps below.

STEP #0 β€” Don't have Node.js + npm installed? Read this. (CLICK TO EXPAND!)

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 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.

You can verify the install by opening your terminal app and typing...

node -v
# Results into v9.1.0 β€” make sure you have Node >= 8 installed.

npm -v
# Results into 5.6.0 β€” make sure you have npm >= 5.3 installed.

β†’ STEP #1

All you have to do is run the following command and it will create a WordPress block plugin. It's done by installing and running the create-guten-block command and providing it with a unique name for a WordPress plugin that will get created.

⚠️ Make sure run this command in your local WordPress install's plugins folder i.e. /local_dev_site.tld/wp-content/plugins/ folder β€” since this command will produce a WordPress plugin that you can go to WP Admin β–ΆοΈŽ Plugins to activate.

npx create-guten-block my-block

(npx comes with npm 5.2+ and higher, see instructions for older npm versions)

npx block

It'll take a couple of minutes to install.

You’ll need to have Node >= 8 and npm >= 5.3 on your local development machine (but it’s not required on the server). You can use nvm (macOS/Linux) or nvm-windows to easily switch Node versions between different projects.

It will create a directory called my-block inside the current folder. Inside that directory, it will generate the initial project structure and install the transitive dependencies:

INSIDE: /local_dev_site.tld/wp-content/plugins/my-block

β”œβ”€β”€ .gitignore
β”œβ”€β”€ plugin.php
β”œβ”€β”€ package.json
β”œβ”€β”€ readme.md
|
β”œβ”€β”€ dist
|  β”œβ”€β”€ blocks.build.js
|  β”œβ”€β”€ blocks.editor.build.css
|  └── blocks.style.build.css
|
└── src
   β”œβ”€β”€ block
   |  β”œβ”€β”€ block.js
   |  β”œβ”€β”€ editor.scss
   |  └── style.scss
   |
   β”œβ”€β”€ blocks.js
   β”œβ”€β”€ common.scss
   └── init.php

No configuration or complicated folder structures, just the files you need to build your app.

β†’ STEP #2

Once the installation is done, you can open your project folder and run the start script.

Let's do that.

cd my-block
npm start

You can also use yarn start if that's your jam.

cgb-npm-start

This runs the plugin in development mode. To produce production code run npm run build. You will see the build messages, errors, and lint warnings in the console.

And just like that, you're building your next WordPress plugin with Gutenberg, React.js, ES 6/7/8/Next, transpiled with Babel, which also has ESLint configurations for your code editor to pick up and use automatically.


More

Workflow!

There are just three scripts that you can use in your create-guten-block workflow. With these three scripts, you can develop, build, and eject your plugin.

πŸ‘‰ npm start

  • Use to compile and run the block in development mode.
  • Watches for any changes and reports back any errors in your code.

πŸ‘‰ npm run build

  • Use to build production code for your block inside dist folder.
  • Runs once and reports back the gzip file sizes of the produced code.

πŸ‘‰ npm run eject

  • Use to eject your plugin out of create-guten-block.
  • Provides all the configurations so you can customize the project as you want.
  • It's a one-way street, eject and you have to maintain everything yourself.
  • You don't normally have to eject a project because by ejecting you lose the connection with create-guten-block and from there onwards you have to update and maintain all the dependencies on your own.

That's about it.


included

What’s Included?

Your environment will have everything you need to build a modern next-gen WordPress Gutenberg plugin:

  • React, JSX, and ES6 syntax support.
  • webpack dev/production build process behind the scene.
  • Language extras beyond ES6 like the object spread operator.
  • Auto-prefixed CSS, so you don’t need -webkit or other prefixes.
  • A build script to bundle JS, CSS, and images for production with source-maps.
  • Hassle-free updates for the above tools with a single dependency cgb-scripts.

The tradeoff is that these tools are preconfigured to work in a specific way. If your project needs more customization, you can "eject" and customize it, but then you will need to maintain this configuration.


Philosophy

Philosophy

  • One Dependency: There is just one build dependency. It uses webpack, Babel, ESLint, and other amazing projects, but provides a cohesive curated experience on top of them.

  • No Configuration Required: You don't need to configure anything. A reasonably good configuration of both development and production builds is handled for you so you can focus on writing code.

  • No Lock-In: You can eject to a custom setup at any time. Run a single command, and all the configuration and build dependencies will be moved directly into your project, so you can pick up right where you left off.


Why

Why create-guten-block?

Well, it's really hard to configure things like webpack, React, ES 6/7/8/Next, ESLint, Babel, etc. before you even start writing a Hello World Gutenberg block. 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.

create-guten-block hides all this configuration away in an optimized package that we call cgb-scripts. This 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.


tldr

TL;DR

Too long, didn't read? Here's a shorter version.

Open the terminal app and run the following commands.

  • πŸ”° Install/Create: npx create-guten-block my-block β€” Run inside local WP install E.g. /wp.local/wp-content/plugins/ directory.
  • πŸ“‚ Browse: cd my-block β€” Open the newly created plugin directory.
  • ♻️ Run: npm start β€” For development.
  • πŸ“¦ Run: npm run build β€” For production build.
  • ⏏ Run: npm run eject β€” To customize, update, and maintain all by yourself.

Create-Guten-Block has been tested to work on macOS, but must also work on Windows, and Linux. If something doesn’t work, kindly file an issue β†’


update

Updating to New Releases

Create Guten Block is divided into two packages:

  1. create-guten-block is a command-line utility that you use to create new WP Gutenberg plugins.
  2. cgb-scripts is a development dependency in the generated plugin projects.

You never need to update create-guten-block itself as it's run via npx and it delegates all the setup to cgb-scripts.

When you run create-guten-block, it always creates the project with the latest version of cgb-scripts so you’ll get all the new features and improvements in newly created plugins automatically.

To update an existing project to a new version of cgb-scripts, open the changelog, find the version you’re currently on (check package.json in your plugin's folder if you’re not sure), and apply the migration instructions for the newer versions.

In most cases bumping the cgb-scripts version in package.json and running npm install in this folder should be enough, but it’s good to consult the changelog for potential breaking changes.

We commit to keeping the breaking changes minimal so you can upgrade cgb-scripts painlessly.


Log

Changelog

Read what's πŸ“¦ new, πŸ‘Œ improved, πŸ› fixed, and if πŸ“– docs got updated.

πŸ‘‰ Go read the entire changelog at this link β€” CGB Changelog β†’

Nothing's ever complete, so bear with us while we keep iterating towards a better future.

'Coz every night I lie in bed
The brightest colors fill my head
A million dreams are keeping me awake
I think of what the world could be
A vision of the one I see
A million dreams is all it's gonna take
A million dreams for the world we're gonna make ...

... listen to β†’ A million dreams!


Hello

Hello, we're The Dev Couple!

Me (Ahmad Awais) and my incredible wife (Maedah Batool) are two engineers who fell in love with open source and then with each other. You can read more about me here. If you or your company use any of my projects or like what I’m doing then consider backing me. I'm in this for the long run. An open-source developer advocate.

Ahmad on Twitter

NodeCLI.com β€” Learn to build Node.js CLI Automation

This repository is part of the NodeCLI.com course.

After building hundreds of developer automation tools used by millions of developers, I am sharing exactly how you can do it yourself with minimum effective effort. Learn to build Node.js & JavaScript based CLI (Command Line Interface) apps. Automate the grunt work, do more in less time, impress your manager, and help the community. β†’ I'm sharing it all in this online video course. Node CLI Automation without wasting a 1,000 hours β†’

Node CLI

Awais on Twitter


Partners

Project Backers & TheDevCouple Partners ⚑️

This FOSS (free and open source software) project is updated and maintained with the help of awesome businesses listed below. Without the support from these amazing companies/individuals, this project would not have been possible.

β€” What/How? Read more about it β†’


Thanks

License & Attribution

GitHub @AhmadAwaisΒ (follow) TO STAY UP TO DATE ON FREE & OPEN SOURCE SOFTWARE

Twitter @MrAhmadAwaisΒ (follow) TO GET ONE DEV MINUTE DAILY HOT TIPS & TROLLS

YouTube AhmadAwaisΒ (subscribe) TO TECH TALKS & ONE DEV MINUTE VIDEOS

Blog: AhmadAwais.comΒ (read) MOSTLY LONG FORM TECHNICAL ARTICLES

LinkedIn @MrAhmadAwaisΒ (connect) WITH THE LINKEDIN PROFILE Y'ALL

This project is inspired by the work of more people than I could mention here. But thank you, Dan Abramov for Create React App, Andrew Clark, and Christopher Chedeau, Sophie Alpert from React.js team, Kent C. Dodds for his open source evangelism, WordPress Core Contributors, Gary for keeping everyone sane, Gutenberg developers Matias, Riad, Andrew, Ella, Joen, Tammie, Greg and contributors, and other WordPress community members like Zac for his course on Gutenberg, and also my friend Morten for all the #Guten-motivation, Icons8 for the awesome icons, Maedah for managing this project, and to everyone I forgot.

Follow me πŸ‘‹ on Twitter for more updates and questions β†’ Tweet to say Hi



For anything else, tweet at @MrAhmadAwais

I have released a video course to help you learn how to create projects just like this one. Node.js and JavaScript based automation dev-tools and Command-line CLIs β€” Learn to build Node.js CLIS β†’



VSCode

Node CLI Automation β†’

I have released a video course to help you become a better developer β€” Become a VSCode Power User β†’



VSCode

VSCode Power User Course β†’


VSCode Ahmad on Twitter

More Repositories

1

corona-cli

🦠 Track the Coronavirus disease (COVID-19) in the command line. Worldwide for all countries, for one country, and the US States. Fast response time (< 100ms). To chat: https://twitter.com/MrAhmadAwais/
JavaScript
1,848
star
2

WPGulp

An advanced Gulp workflow for WordPress development with extensive documentation. Used by 40,000+ themes and plugins.
JavaScript
1,764
star
3

Emoji-Log

Emoji-Log β€” An Emoji Git commit log messages spec standard. [ πŸ“¦πŸ‘ŒπŸ›πŸ“–πŸš€πŸ€– ‼️]
JavaScript
829
star
4

Gutenberg-Boilerplate

πŸ”° WordPress Gutenberg Boilerplate! β€” Easy to understand and extensively inline documented starter WordPress plugin for the new Gutenberg editor. Think of it like a create-react-app for WP Gutenberg. β€”β€”β€” I now recommend πŸ”₯ βš›β€ πŸ“¦ `create-guten-block` β†’ https://Awais.dev/cgb
JavaScript
785
star
5

shades-of-purple-vscode

πŸ¦„ Shades of Purple β€” A professional theme with hand-picked & bold shades of purple to go along with your VSCode. Reviewed by several designers and 75+ theme versions released to keep it updated. One of the top rated best VSCode themes on VS Code Marketplace. Download β†’
652
star
6

create-node-cli

πŸ“Ÿ CLI to create new Node.js CLI applications in minutes not hours.
JavaScript
628
star
7

awesome-random-stuff

Collection of interesting things I find on the World Wide Web.
387
star
8

VSCode-Tips-Tricks

VSCode-Tips-Tricks Examples and Workflows to help you become a Visual Studio Code Power User β†’
JavaScript
189
star
9

wp-continuous-deployment

DevOps free Continuous-Deployment pipeline for WordPress plugins with GitHub Actions
JavaScript
170
star
10

ramadan-cli

CLI to check Sehar and Iftar times in Ramadan.
JavaScript
144
star
11

Node-CLI-Tips-Tricks

πŸ“Ÿ NodeCLI.com repo with Node.js CLI best practices and production-ready tips & tricks.
JavaScript
144
star
12

WPGulpTheme

A theme to demonstrate simplest implementation of WPGulp Boilerplate. Practical implementation of WPGulp β†’
SCSS
140
star
13

Shades-of-Purple-iTerm2

πŸ¦„ Shades of Purple β€” A professional theme with hand-picked & bold shades of purple for iTerm2 & Zsh.
Shell
127
star
14

Advanced-Gulp-WordPress

An Advanced Gulp Workflow for WordPress themes. [🚨Deprecated in favour of WPGulp https://github.com/ahmadawais/WPGulp | STAR/FORK WPGulp instead]
PHP
122
star
15

WP-OOP-Settings-API

πŸ›  WP-OOP-Settings-API is a Settings API wrapper built with Object Oriented Programming practices.
PHP
97
star
16

WPSass

πŸ• Use Sass with WordPress, Node NPM Script in SCSS flavour. Stop worrying about build tools, use this repo as a base to get started.
CSS
97
star
17

hacktoberfest

#Hacktoberfest + Git Resources | Contributions beginners just like you. Jump in! 🎯
91
star
18

gatsby-package-manager

Gatsby Package Manager (gpm) helps you install a Gatsby package with all of its dependencies.
JavaScript
91
star
19

_child

_child is a WordPress Child Theme Boilerplate
PHP
86
star
20

WPCustomize

🎩 WP Customize component related boilerplate theme and features implementation. Basic customizer controls, settings, implementation with focus on secure and sanitized data.
PHP
85
star
21

Sendy-PHP-API

πŸš€ Sendy PHP API Wrapper: Complete API interfacing.
PHP
82
star
22

wifi-pswd-cli

Get a saved WiFi password
JavaScript
76
star
23

github-stars-contributions

Log your GitHub Stars Contributions with the ease of a command line CLI
JavaScript
73
star
24

ReSass

πŸ’»πŸ“±πŸ–₯ Sass SCSS Responsive Media Queries Mixin for Eight Different Screen Sizes!
CSS
66
star
25

resize-optimize-images

πŸ—ƒ Resize and optimize bmp, gif, jpeg, png, & tiff images in Node.js.
JavaScript
66
star
26

Sublime-WP-Customizer

πŸš€ Sublime Text package of snippets for WordPress Customizer. Helps you write standard WordPress code for Customizer with different kinds of snippets β€”Β in seconds.
PHP
59
star
27

Shades-of-Purple-Hyper

πŸ¦„ Shades of Purple β€” A professional theme with hand-picked & bold shades of purple for Hyper Terminal.
JavaScript
51
star
28

cli-welcome

πŸ“Ÿ Welcome header for Node.js CLI software.
JavaScript
49
star
29

WP-Shortcode-Boilerplate

A standardized, organized, modular foundation for building simple & basic shortcodes in form of a WordPress Plugins.
PHP
49
star
30

cli-alerts

[βœ”οΈ ℹ️ ⚠️ βœ–] Cross platform CLI Alerts with colors & colored symbols for success, info, warning, error. Works on macOS, Linux, and Windows.
JavaScript
47
star
31

Emoji-Log-VSCode

Emoji-Log VSCode Extension β€” An Emoji Git commit log messages spec standard. [ πŸ“¦πŸ‘ŒπŸ›πŸ“–πŸš€πŸ€– ‼️]
TypeScript
46
star
32

deno-beginner

πŸ¦• Deno examples and projects for the free video course for deno beginners β†’
TypeScript
42
star
33

WP-REST-Allow-All-CORS

Allow all cross origin requests to your WordPress site's REST API.
PHP
38
star
34

Neat

Neat is an advanced WordPress Base theme which uses Gulp, Sass etc. with auto theme package builder.
PHP
38
star
35

Shades-of-Purple-Slack

πŸ¦„ Shades of Purple β€” A professional theme with hand-picked & bold shades of purple for Slack.
34
star
36

this-in-JavaScript

πŸ”° Learn the concept of `this` in JavaScript! β€” [five concepts]
34
star
37

Styled-Responsive-Media-Queries

Responsive Media Queries for Emotion styled or styled-components β€” Standard size from Chrome DevTools.
JavaScript
33
star
38

WPAutoPot

πŸ“¦ Auto Generate WordPress .POT (Portable Objects Template) files via NPM Scripts or Gulp.
JavaScript
32
star
39

cli-meow-help

🐈 Generate automagically formatted help text for `meow` CLI app helper.
JavaScript
32
star
40

dotfiles

A non-exhaustive collection of my dotfiles.
Shell
30
star
41

CF7-Customizer

πŸ‘Œ Customize, style and theme your WordPress Contact Forms. An intuitive plugin to design your contact forms via WordPress live customizer, right at the front-end.
PHP
29
star
42

WP-Welcome-Page-Boilerplate

WordPress plugin welcome page boilerplate!
PHP
24
star
43

WP-Salts-Update-CLI

Update WordPress salts through CLI all automated ;)
Shell
23
star
44

Cobalt3-iTerm

Cobalt3 Colour Scheme for iTerm2 + ZSH
Shell
22
star
45

vacation-rentals

It's like AirBNB for WordPress. A massive project that extends WordPress for Vacation Rentals booking, indexing, curating, etc.
PHP
20
star
46

cPanel-EasyEngine-Migrate-CLI

CEM CLI | cPanel to EasyEngine Migrate CLI
Shell
19
star
47

clear-any-console

πŸ“Ÿ Cross platform console clear for your next Node.js CLI
JavaScript
18
star
48

lerna-tutorial

A tutorial for learning lerna.
Shell
18
star
49

shades-of-purple-google-chrome

πŸ¦„ Shades of Purple β€” A professional theme with hand-picked & bold shades of purple for Google Chrome.
18
star
50

shades-of-purple-alacritty

πŸ¦„ Shades of Purple β€” A professional theme with hand-picked & bold shades of purple for Alacritty.
17
star
51

WPImgOptimizer

WordPress image optimisation development workflow.
JavaScript
17
star
52

scrolls-top

Function that scrolls window to the top, smoothly.
JavaScript
16
star
53

Shades-of-Purple-HighlightJS

πŸ¦„ Shades of Purple β€” A professional theme with hand-picked & bold shades of purple for HighlightJS.
CSS
13
star
54

Proposal-Modern-Tooling

πŸ› οΈ A developer build tooling proposal for modern JavaScript based WordPress Core.
13
star
55

get-online-img

πŸ“₯ Download an image by providing a URL and path in Node.js.
JavaScript
12
star
56

action-auto-changelog

Generate a changelog automatically for your npm packages with GitHub actions.
Shell
12
star
57

tailwind-text-decoration-color

JavaScript
11
star
58

PTCL-CLI-Bash

PTCL-CLI: An intuitive PTCL-CLI to control PTCL routers via command line.
Shell
10
star
59

is-it-git

Checks if the current working directory is a git repository.
JavaScript
10
star
60

sponsor

πŸ™Œ Sponsor Ahmad Awais on his full-time #OpenSourcerer journey of creating free software.
10
star
61

Twig-Tutorial

Twig Tutorial Theme based on Neat for Tuts+
PHP
10
star
62

GitHub-Fold

πŸ—ƒοΈ Google Chrome Extension to fold/unfold GitHub repo files.
JavaScript
10
star
63

cli-handle-error

Custom error handler for Node.js CLIs.
JavaScript
10
star
64

learn-react

Learn React.js with Awais.
HTML
10
star
65

Shades-of-Purple-Konsole

πŸ¦„ Shades of Purple β€” A professional theme with hand-picked & bold shades of purple for Konsole.
10
star
66

ptcl-cli

πŸ“Ÿ Control PTCL router via command line. [Reboot, Get Stats, Screenshot xDSL for complaints].
JavaScript
10
star
67

lwj-cli

Learn with Jason via CLI.
JavaScript
9
star
68

wordle-solved

wordle-solution by Awais
JavaScript
9
star
69

base16-shades-of-purple

πŸ¦„ Shades of Purple β€” A professional theme with hand-picked & bold shades of purple for Base16.
9
star
70

WP-Welcome-Page-Boilerplate-For-TutsPlus

Welcome page plugin boilerplate for Envato Tuts+ tutorial series.
PHP
9
star
71

WPGitDeploy-CLI

Deploy your WordPress plugin from GitHub to WordPress.org SVN repository.
Shell
8
star
72

Shades-of-Purple-IntelliJ

Work in progress Shades of Purple theme for IntelliJ
8
star
73

next-js-blog-with-comments

JavaScript
8
star
74

shades-of-purple-alfred

πŸ¦„ Shades of Purple β€” A professional theme with hand-picked & bold shades of purple for Alfred App.
8
star
75

wordle-solved-cli

wordle-solved-cli by Awais
JavaScript
8
star
76

nodecli

Node.js CLI Automation
JavaScript
7
star
77

gatsby-plugin-paddle

βš›οΈ Gatsby plugin that adds paddle.js to your site.
JavaScript
7
star
78

Gutenberg-Multi-Block-Webpack-ES6

WORK IN PROGRESS
JavaScript
7
star
79

gatsby-minimal-blog

Minimal blog made with React, Gatsby, Styled Components and a lot more.
JavaScript
7
star
80

sitemaps-compare

Compare two sitemaps by converting them to files with URLs and VSCode
JavaScript
7
star
81

ahmadawais

Hello, nice to meet you.
7
star
82

has-fetch

Check if the client-side browser has the fetch API support.
JavaScript
6
star
83

DotGitIgnore

My go to .gitignore file.
6
star
84

shadesOfPurpleIntellij

6
star
85

VuePress-Base

VuePress Docs site base with Shades of Purple set up.
6
star
86

Gutenberg-Blocks

❌ DEPRECATED in the favour of https://github.com/ahmadawais/Gutenberg-Boilerplate
PHP
6
star
87

stuff

πŸ‘€ Random Stuff!
HTML
6
star
88

cli-check-node

Check the installed Node.js version and exit as per the required Node.js version.
JavaScript
6
star
89

is-dir-empty

Check if a directory is empty with Node.js. Promise based.
JavaScript
6
star
90

BR-CLI

BRCLI is a Backup & Restore CLI. It's built for self hosted VPS with EasyEngine for WP websites.
Shell
6
star
91

create-rapid-api

create-rapid-api by Awais
JavaScript
6
star
92

base16-shades-of-purple-exported-themes

Exported themes from the Shades of Purple for Base16 color scheme.
Vim Script
6
star
93

Talk_Personal_Development_for_a_WordPress_Developer

WordPress Meetup Lahore talk: Personal Development for a WordPress Developer
JavaScript
6
star
94

scarfit

Add scarf analytics to a Node pkg, git commit/push, and release an npm patch
JavaScript
6
star
95

with-mdx-remote

JavaScript
5
star
96

wp-release-it

WordPress plugin release automation that works.
JavaScript
5
star
97

next-base

My custom Next.js base to start projects.
JavaScript
5
star
98

gatsby-remark-better-embed-video

πŸ“Ί Embed Videos (Youtube, Vimeo, VideoPress) in Gatsby via Markdown with better options.
JavaScript
5
star
99

Woo-Keep-The-Change

Woo Keep The Change plugin helps online store owners keep the change :) i.e. Total $50 instead of $49.28.
PHP
5
star
100

Install-WPGulp

πŸš€ Installs WPGulp for you. Downloads all the required files and installs node packages. [Node >= 8 and npm >= 5.3].
JavaScript
5
star