From e7e3b6bd48be12f363ac80aca0398484209f5a9c Mon Sep 17 00:00:00 2001 From: Josh Pollock Date: Sat, 16 Dec 2017 13:00:10 -0500 Subject: [PATCH 1/4] Make it more clear how block command relates to plugins and themes #104 --- README.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 545d49124..1842d31e4 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ See the [Underscores website](https://underscores.me/) for more details. ### wp scaffold block -Generates PHP, JS and CSS code for registering a Gutenberg block. +Generates PHP, JS and CSS code for registering a Gutenberg block for a plugin or theme. ~~~ wp scaffold block [--title=] [--dashicon=<dashicon>] [--category=<category>] [--textdomain=<textdomain>] [--theme] [--plugin=<plugin>] [--force] @@ -91,6 +91,8 @@ wp scaffold block <slug> [--title=<title>] [--dashicon=<dashicon>] [--category=< Blocks are the fundamental element of the Gutenberg editor. They are the primary way in which plugins and themes can register their own functionality and extend the capabilities of the editor. Visit https://wordpress.org/gutenberg/handbook/block-api/ to learn more about Block API. +When you scaffold a block you must use either the theme or plugin option. + **OPTIONS** <slug> @@ -131,8 +133,15 @@ Visit https://wordpress.org/gutenberg/handbook/block-api/ to learn more about Bl # Generate a 'movie' block for the 'simple-life' theme $ wp scaffold block movie --title="Movie block" --theme=simple-life Success: Created block 'Movie block'. - - + + # Generate a 'movie' block for the 'movies' plugin + $ wp scaffold block movie --title="Movie block" --plugin=movies + Success: Created block 'Movie block'. + + # Create a bew plugin and add two blocks + $ wp scaffold plugin books + $ wp scaffold book books --title="Book" --plugin=books + $ wp scaffold books books --title="Book List" --plugin=books ### wp scaffold child-theme From 9e719c00120cafdd201fce7ca27143b94ed451dc Mon Sep 17 00:00:00 2001 From: Josh Pollock <jpollock412@gmail.com> Date: Sat, 16 Dec 2017 14:42:37 -0500 Subject: [PATCH 2/4] Improve readme further by removing typo #104 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1842d31e4..646f1a663 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,7 @@ When you scaffold a block you must use either the theme or plugin option. $ wp scaffold block movie --title="Movie block" --plugin=movies Success: Created block 'Movie block'. - # Create a bew plugin and add two blocks + # Create a new plugin and add two blocks $ wp scaffold plugin books $ wp scaffold book books --title="Book" --plugin=books $ wp scaffold books books --title="Book List" --plugin=books From 35aa95f33a4bfb2b447eead8e5a7361f052cb8e3 Mon Sep 17 00:00:00 2001 From: Josh Pollock <jpollock412@gmail.com> Date: Sat, 16 Dec 2017 14:45:35 -0500 Subject: [PATCH 3/4] #104 more inline docs in code examples. --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 646f1a663..5aa5dbc4e 100644 --- a/README.md +++ b/README.md @@ -139,9 +139,12 @@ When you scaffold a block you must use either the theme or plugin option. Success: Created block 'Movie block'. # Create a new plugin and add two blocks + # Create plugin called books $ wp scaffold plugin books - $ wp scaffold book books --title="Book" --plugin=books - $ wp scaffold books books --title="Book List" --plugin=books + # Add a block called book to plugin books + $ wp scaffold block book --title="Book" --plugin=books + # Add a second block to plugin called books. + $ wp scaffold block books --title="Book List" --plugin=books ### wp scaffold child-theme From d9ddc74aaaced9891e0c3e23c07d23413f50b189 Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber <daniel@handbuilt.co> Date: Mon, 18 Dec 2017 06:05:36 -0800 Subject: [PATCH 4/4] Add doc changes to the command, aka source of truth --- src/Scaffold_Command.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Scaffold_Command.php b/src/Scaffold_Command.php index b415bb076..d67e79cc9 100644 --- a/src/Scaffold_Command.php +++ b/src/Scaffold_Command.php @@ -201,11 +201,13 @@ private function _scaffold( $slug, $assoc_args, $defaults, $subdir, $templates ) } /** - * Generates PHP, JS and CSS code for registering a Gutenberg block. + * Generates PHP, JS and CSS code for registering a Gutenberg block for a plugin or theme. * * Blocks are the fundamental element of the Gutenberg editor. They are the primary way in which plugins and themes can register their own functionality and extend the capabilities of the editor. * Visit https://wordpress.org/gutenberg/handbook/block-api/ to learn more about Block API. * + * When you scaffold a block you must use either the theme or plugin option. + * * ## OPTIONS * * <slug> @@ -247,6 +249,18 @@ private function _scaffold( $slug, $assoc_args, $defaults, $subdir, $templates ) * $ wp scaffold block movie --title="Movie block" --theme=simple-life * Success: Created block 'Movie block'. * + * # Generate a 'movie' block for the 'movies' plugin + * $ wp scaffold block movie --title="Movie block" --plugin=movies + * Success: Created block 'Movie block'. + * + * # Create a new plugin and add two blocks + * # Create plugin called books + * $ wp scaffold plugin books + * # Add a block called book to plugin books + * $ wp scaffold block book --title="Book" --plugin=books + * # Add a second block to plugin called books. + * $ wp scaffold block books --title="Book List" --plugin=books + * * @subcommand block */ public function block( $args, $assoc_args ) {