Skip to content

Commit 2946d04

Browse files
maximebjAhmad Awais ⚑️
authored andcommitted
πŸ› FIX: Enqueue dependencies for WP5. (#107) (#110)
I've updated the dependencies on enqueue functions in order to make it work with WP5 RC. Styles are now loading well. It's my first PR, please double-check my work Also, I'm waiting an answer from the official Gut staff to be sure than theses dependencies are the right ones : maybe I'll publish another one soon, but right now the issue is fixed The documentation about this is on wp.org is 404. (#107) (#110)
1 parent d5463ee commit 2946d04

6 files changed

Lines changed: 35 additions & 29 deletions

File tree

β€Žexamples/01-single-block/src/init.phpβ€Ž

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* Enqueue Gutenberg block assets for both frontend + backend.
1818
*
19-
* `wp-blocks`: includes block type registration and related functions.
19+
* `wp-editor`: WP editor styles.
2020
*
2121
* @since 1.0.0
2222
*/
@@ -25,7 +25,7 @@ function single_block_cgb_block_assets() {
2525
wp_enqueue_style(
2626
'single_block-cgb-style-css', // Handle.
2727
plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), // Block style CSS.
28-
array( 'wp-blocks' ) // Dependency to include the CSS after it.
28+
array( 'wp-editor' ) // Dependency to include the CSS after it.
2929
// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: filemtime β€” Gets file modification time.
3030
);
3131
} // End function single_block_cgb_block_assets().
@@ -36,9 +36,10 @@ function single_block_cgb_block_assets() {
3636
/**
3737
* Enqueue Gutenberg block assets for backend editor.
3838
*
39-
* `wp-blocks`: includes block type registration and related functions.
39+
* `wp-blocks`: includes block type registration and related functions.
4040
* `wp-element`: includes the WordPress Element abstraction for describing the structure of your blocks.
41-
* `wp-i18n`: To internationalize the block's text.
41+
* `wp-i18n`: internationalize the block's text.
42+
* `wp-editor`: WP editor styles.
4243
*
4344
* @since 1.0.0
4445
*/
@@ -47,7 +48,7 @@ function single_block_cgb_editor_assets() {
4748
wp_enqueue_script(
4849
'single_block-cgb-block-js', // Handle.
4950
plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack.
50-
array( 'wp-blocks', 'wp-i18n', 'wp-element' ) // Dependencies, defined above.
51+
array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor' ) // Dependencies, defined above.
5152
// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.build.js' ) // Version: filemtime β€” Gets file modification time.
5253
);
5354

β€Žexamples/02-single-block-ejected/src/init.phpβ€Ž

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* Enqueue Gutenberg block assets for both frontend + backend.
1818
*
19-
* `wp-blocks`: includes block type registration and related functions.
19+
* `wp-editor`: WP editor styles.
2020
*
2121
* @since 1.0.0
2222
*/
@@ -25,7 +25,7 @@ function single_block_cgb_block_assets() {
2525
wp_enqueue_style(
2626
'single_block-cgb-style-css', // Handle.
2727
plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), // Block style CSS.
28-
array( 'wp-blocks' ) // Dependency to include the CSS after it.
28+
array( 'wp-editor' ) // Dependency to include the CSS after it.
2929
// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: filemtime β€” Gets file modification time.
3030
);
3131
} // End function single_block_cgb_block_assets().
@@ -36,9 +36,10 @@ function single_block_cgb_block_assets() {
3636
/**
3737
* Enqueue Gutenberg block assets for backend editor.
3838
*
39-
* `wp-blocks`: includes block type registration and related functions.
39+
* `wp-blocks`: includes block type registration and related functions.
4040
* `wp-element`: includes the WordPress Element abstraction for describing the structure of your blocks.
41-
* `wp-i18n`: To internationalize the block's text.
41+
* `wp-i18n`: internationalize the block's text.
42+
* `wp-editor`: WP editor styles.
4243
*
4344
* @since 1.0.0
4445
*/
@@ -47,7 +48,7 @@ function single_block_cgb_editor_assets() {
4748
wp_enqueue_script(
4849
'single_block-cgb-block-js', // Handle.
4950
plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack.
50-
array( 'wp-blocks', 'wp-i18n', 'wp-element' ) // Dependencies, defined above.
51+
array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor' ) // Dependencies, defined above.
5152
// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.build.js' ) // Version: filemtime β€” Gets file modification time.
5253
);
5354

β€Žexamples/03-multi-block/src/init.phpβ€Ž

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* Enqueue Gutenberg block assets for both frontend + backend.
1818
*
19-
* `wp-blocks`: includes block type registration and related functions.
19+
* `wp-editor`: WP editor styles.
2020
*
2121
* @since 1.0.0
2222
*/
@@ -25,7 +25,7 @@ function multi_block_cgb_block_assets() {
2525
wp_enqueue_style(
2626
'multi_block-cgb-style-css', // Handle.
2727
plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), // Block style CSS.
28-
array( 'wp-blocks' ) // Dependency to include the CSS after it.
28+
array( 'wp-editor' ) // Dependency to include the CSS after it.
2929
// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: filemtime β€” Gets file modification time.
3030
);
3131
} // End function multi_block_cgb_block_assets().
@@ -36,9 +36,10 @@ function multi_block_cgb_block_assets() {
3636
/**
3737
* Enqueue Gutenberg block assets for backend editor.
3838
*
39-
* `wp-blocks`: includes block type registration and related functions.
39+
* `wp-blocks`: includes block type registration and related functions.
4040
* `wp-element`: includes the WordPress Element abstraction for describing the structure of your blocks.
41-
* `wp-i18n`: To internationalize the block's text.
41+
* `wp-i18n`: internationalize the block's text.
42+
* `wp-editor`: WP editor styles.
4243
*
4344
* @since 1.0.0
4445
*/
@@ -47,7 +48,7 @@ function multi_block_cgb_editor_assets() {
4748
wp_enqueue_script(
4849
'multi_block-cgb-block-js', // Handle.
4950
plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack.
50-
array( 'wp-blocks', 'wp-i18n', 'wp-element' ) // Dependencies, defined above.
51+
array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor' ) // Dependencies, defined above.
5152
// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.build.js' ) // Version: filemtime β€” Gets file modification time.
5253
);
5354

β€Žexamples/04-multi-block-ejected/src/init.phpβ€Ž

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* Enqueue Gutenberg block assets for both frontend + backend.
1818
*
19-
* `wp-blocks`: includes block type registration and related functions.
19+
* `wp-editor`: WP editor styles.
2020
*
2121
* @since 1.0.0
2222
*/
@@ -25,7 +25,7 @@ function multi_block_cgb_block_assets() {
2525
wp_enqueue_style(
2626
'multi_block-cgb-style-css', // Handle.
2727
plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), // Block style CSS.
28-
array( 'wp-blocks' ) // Dependency to include the CSS after it.
28+
array( 'wp-editor' ) // Dependency to include the CSS after it.
2929
// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: filemtime β€” Gets file modification time.
3030
);
3131
} // End function multi_block_cgb_block_assets().
@@ -36,9 +36,10 @@ function multi_block_cgb_block_assets() {
3636
/**
3737
* Enqueue Gutenberg block assets for backend editor.
3838
*
39-
* `wp-blocks`: includes block type registration and related functions.
39+
* `wp-blocks`: includes block type registration and related functions.
4040
* `wp-element`: includes the WordPress Element abstraction for describing the structure of your blocks.
41-
* `wp-i18n`: To internationalize the block's text.
41+
* `wp-i18n`: internationalize the block's text.
42+
* `wp-editor`: WP editor styles.
4243
*
4344
* @since 1.0.0
4445
*/
@@ -47,7 +48,7 @@ function multi_block_cgb_editor_assets() {
4748
wp_enqueue_script(
4849
'multi_block-cgb-block-js', // Handle.
4950
plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack.
50-
array( 'wp-blocks', 'wp-i18n', 'wp-element' ) // Dependencies, defined above.
51+
array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor' ) // Dependencies, defined above.
5152
// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.build.js' ) // Version: filemtime β€” Gets file modification time.
5253
);
5354

β€Žexamples/05-a11y-input/src/init.phpβ€Ž

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* Enqueue Gutenberg block assets for both frontend + backend.
1818
*
19-
* `wp-blocks`: includes block type registration and related functions.
19+
* `wp-editor`: WP editor styles.
2020
*
2121
* @since 1.0.0
2222
*/
@@ -25,7 +25,7 @@ function a11y_input_cgb_block_assets() {
2525
wp_enqueue_style(
2626
'a11y_input-cgb-style-css', // Handle.
2727
plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), // Block style CSS.
28-
array( 'wp-blocks' ) // Dependency to include the CSS after it.
28+
array( 'wp-editor' ) // Dependency to include the CSS after it.
2929
// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: filemtime β€” Gets file modification time.
3030
);
3131
} // End function a11y_input_cgb_block_assets().
@@ -36,9 +36,10 @@ function a11y_input_cgb_block_assets() {
3636
/**
3737
* Enqueue Gutenberg block assets for backend editor.
3838
*
39-
* `wp-blocks`: includes block type registration and related functions.
39+
* `wp-blocks`: includes block type registration and related functions.
4040
* `wp-element`: includes the WordPress Element abstraction for describing the structure of your blocks.
41-
* `wp-i18n`: To internationalize the block's text.
41+
* `wp-i18n`: internationalize the block's text.
42+
* `wp-editor`: WP editor styles.
4243
*
4344
* @since 1.0.0
4445
*/
@@ -47,7 +48,7 @@ function a11y_input_cgb_editor_assets() {
4748
wp_enqueue_script(
4849
'a11y_input-cgb-block-js', // Handle.
4950
plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack.
50-
array( 'wp-blocks', 'wp-i18n', 'wp-element' ), // Dependencies, defined above.
51+
array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor' ), // Dependencies, defined above.
5152
// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.build.js' ), // Version: filemtime β€” Gets file modification time.
5253
true // Enqueue the script in the footer.
5354
);

β€Žpackages/cgb-scripts/template/src/init.phpβ€Ž

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* Enqueue Gutenberg block assets for both frontend + backend.
1818
*
19-
* `wp-blocks`: includes block type registration and related functions.
19+
* `wp-editor`: WP editor styles.
2020
*
2121
* @since 1.0.0
2222
*/
@@ -25,7 +25,7 @@ function <% blockNamePHPLower %>_cgb_block_assets() {
2525
wp_enqueue_style(
2626
'<% blockNamePHPLower %>-cgb-style-css', // Handle.
2727
plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), // Block style CSS.
28-
array( 'wp-blocks' ) // Dependency to include the CSS after it.
28+
array( 'wp-editor' ) // Dependency to include the CSS after it.
2929
// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: filemtime β€” Gets file modification time.
3030
);
3131
} // End function <% blockNamePHPLower %>_cgb_block_assets().
@@ -36,9 +36,10 @@ function <% blockNamePHPLower %>_cgb_block_assets() {
3636
/**
3737
* Enqueue Gutenberg block assets for backend editor.
3838
*
39-
* `wp-blocks`: includes block type registration and related functions.
39+
* `wp-blocks`: includes block type registration and related functions.
4040
* `wp-element`: includes the WordPress Element abstraction for describing the structure of your blocks.
41-
* `wp-i18n`: To internationalize the block's text.
41+
* `wp-i18n`: internationalize the block's text.
42+
* `wp-editor`: WP editor styles.
4243
*
4344
* @since 1.0.0
4445
*/

0 commit comments

Comments
Β (0)