Skip to content

Commit

Permalink
Merge pull request #105 from Shelob9/patch-1
Browse files Browse the repository at this point in the history
Make it more clear how block command relates to plugins and themes
  • Loading branch information
danielbachhuber authored Dec 18, 2017
2 parents 6779960 + d9ddc74 commit ae28dd4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <slug> [--title=<title>] [--dashicon=<dashicon>] [--category=<category>] [--textdomain=<textdomain>] [--theme] [--plugin=<plugin>] [--force]
Expand All @@ -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>
Expand Down Expand Up @@ -131,8 +133,18 @@ 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 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

### wp scaffold child-theme

Expand Down
16 changes: 15 additions & 1 deletion src/Scaffold_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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 ) {
Expand Down

0 comments on commit ae28dd4

Please sign in to comment.