You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And general questions to understand the source code:
(ge) path = gutenberg-examples/01-basic/block.js
Why the block_type is named example-01-basic from blocks.registerBlockType( 'gutenberg-examples/example-01-basic', {
What does this mean? step 1 (from the editor). from 'Hello World, step 1 (from the editor).'
The same in (hb) (Step 1) from title: 'Hello World (Step 1)',
The namings are totally different:
(hb) wp_register_script( 'gutenberg-boilerplate-es5-step01', plugins_url( 'step-01/block.js', __FILE__ ), array( 'wp-blocks', 'wp-element' )
In the Gutenberg handbook is a tutorial "Creating Block Types". This seems to be for very beginners. There is stated:
The plugin for download is this one with these examples: /gutenberg-examples
Comparing source codes you'll find that they are not identical.
For example chapter one "writing your first block type"
--- enqueuing Block scripts ---
Handbook (hb)
wp_register_script(
Gutenberg-examples (ge) 01-baisc
wp_enqueue_script(
(hb)
register_block_type(
(ge)
blocks.registerBlockType(
(hb) missing i18n
(hb) use of prefix wp.
var el = wp.element.createElement
(ge)
var el = element.createElement;
(hb) missing
window.wp.blocks, window.wp.i18n, window.wp.element
(hb) missing
filemtime( plugin_dir_path( __FILE__ ) . 'block.js' )
And general questions to understand the source code:
(ge) path = gutenberg-examples/01-basic/block.js
Why the block_type is named example-01-basic from
blocks.registerBlockType( 'gutenberg-examples/example-01-basic', {
What does this mean?
step 1 (from the editor).
from'Hello World, step 1 (from the editor).'
The same in (hb)
(Step 1)
fromtitle: 'Hello World (Step 1)',
The namings are totally different:
(hb)
wp_register_script( 'gutenberg-boilerplate-es5-step01', plugins_url( 'step-01/block.js', __FILE__ ), array( 'wp-blocks', 'wp-element' )
(ge)
wp_enqueue_script( 'gutenberg-examples-01', plugins_url( 'block.js', __FILE__ ), array( 'wp-blocks', 'wp-i18n', 'wp-element' ), filemtime( plugin_dir_path( __FILE__ ) . 'block.js' )
If you look in the other examples you'll find more inconsistency
As learning references these examples are not particularly helpful, on the contrary, they are confusing - especially for beginners.
What is wrong, what should I use, why there is a prefix wp. there not, why there it is blocks.register... and there register?... and so on.
The text was updated successfully, but these errors were encountered: