Block: Update PHP template to use the server script and style api#111
Block: Update PHP template to use the server script and style api#111schlessera merged 3 commits intowp-cli:masterfrom gziolo:update/block-block-php
Conversation
|
@schlessera can you review this one? :) |
templates/block-php.mustache
Outdated
|
|
||
| /** | ||
| * Enqueues block assets to apply inside the editor only. | ||
| * Enqueues all block assets to apply both on the front of your site and in the editor. |
There was a problem hiding this comment.
This only registers the assets now, it doesn't enqueue them anymore.
There was a problem hiding this comment.
register_block_type enqueues everything. See: https://github.com/WordPress/gutenberg/blob/a41173b0be06c5c8c8e397bfb7b30604099e3182/lib/blocks.php#L29
and
https://github.com/WordPress/gutenberg/pull/4039/files#diff-620130744b6b73b822a3df609671d930R606.
There was a problem hiding this comment.
Yes, but that is done only indirectly (just like WordPress enqueues everything, at one point). Wouldn't it be more accurate to say something like:
Registers all block assets so that they can be enqueued through Gutenberg in the corresponding context.
templates/block-php.mustache
Outdated
| plugins_url( $style_css, __FILE__ ), | ||
| array( | ||
| 'wp-blocks', | ||
| §'wp-blocks', |
There was a problem hiding this comment.
You seem to have introduced an unintended change here: §
There was a problem hiding this comment.
I noticed that myself, too. It's already removed.
|
Updated again, should be good now :) |
Block: Update PHP template to use the server script and style api
This PR updates PHP template generated with
wp scaffold blockcommand. It adds changes introduced by @aduth in WordPress/gutenberg#4039. Both ways are still supported, but the new one is the preferred one.Generated output after changes introduced: