Skip to content

Commit f00fb62

Browse files
committed
πŸ‘Œ IMPROVE: Code Comments
1 parent f6b739c commit f00fb62

5 files changed

Lines changed: 19 additions & 18 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function single_block_cgb_block_assets() {
2626
'single_block-cgb-style-css', // Handle.
2727
plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), // Block style CSS.
2828
array( 'wp-blocks' ) // Dependency to include the CSS after it.
29-
// filemtime( plugin_dir_path( __FILE__ ) . 'editor.css' ) // Version: filemtime β€” Gets file modification time.
29+
// 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().
3232

@@ -48,15 +48,15 @@ function single_block_cgb_editor_assets() {
4848
'single_block-cgb-block-js', // Handle.
4949
plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack.
5050
array( 'wp-blocks', 'wp-i18n', 'wp-element' ) // Dependencies, defined above.
51-
// filemtime( plugin_dir_path( __FILE__ ) . 'block.js' ) // Version: filemtime β€” Gets file modification time.
51+
// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.build.js' ) // Version: filemtime β€” Gets file modification time.
5252
);
5353

5454
// Styles.
5555
wp_enqueue_style(
5656
'single_block-cgb-block-editor-css', // Handle.
5757
plugins_url( 'dist/blocks.editor.build.css', dirname( __FILE__ ) ), // Block editor CSS.
5858
array( 'wp-edit-blocks' ) // Dependency to include the CSS after it.
59-
// filemtime( plugin_dir_path( __FILE__ ) . 'editor.css' ) // Version: filemtime β€” Gets file modification time.
59+
// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.editor.build.css' ) // Version: filemtime β€” Gets file modification time.
6060
);
6161
} // End function single_block_cgb_editor_assets().
6262

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function single_block_cgb_block_assets() {
2626
'single_block-cgb-style-css', // Handle.
2727
plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), // Block style CSS.
2828
array( 'wp-blocks' ) // Dependency to include the CSS after it.
29-
// filemtime( plugin_dir_path( __FILE__ ) . 'editor.css' ) // Version: filemtime β€” Gets file modification time.
29+
// 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().
3232

@@ -48,15 +48,15 @@ function single_block_cgb_editor_assets() {
4848
'single_block-cgb-block-js', // Handle.
4949
plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack.
5050
array( 'wp-blocks', 'wp-i18n', 'wp-element' ) // Dependencies, defined above.
51-
// filemtime( plugin_dir_path( __FILE__ ) . 'block.js' ) // Version: filemtime β€” Gets file modification time.
51+
// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.build.js' ) // Version: filemtime β€” Gets file modification time.
5252
);
5353

5454
// Styles.
5555
wp_enqueue_style(
5656
'single_block-cgb-block-editor-css', // Handle.
5757
plugins_url( 'dist/blocks.editor.build.css', dirname( __FILE__ ) ), // Block editor CSS.
5858
array( 'wp-edit-blocks' ) // Dependency to include the CSS after it.
59-
// filemtime( plugin_dir_path( __FILE__ ) . 'editor.css' ) // Version: filemtime β€” Gets file modification time.
59+
// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.editor.build.css' ) // Version: filemtime β€” Gets file modification time.
6060
);
6161
} // End function single_block_cgb_editor_assets().
6262

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function multi_block_cgb_block_assets() {
2626
'multi_block-cgb-style-css', // Handle.
2727
plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), // Block style CSS.
2828
array( 'wp-blocks' ) // Dependency to include the CSS after it.
29-
// filemtime( plugin_dir_path( __FILE__ ) . 'editor.css' ) // Version: filemtime β€” Gets file modification time.
29+
// 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().
3232

@@ -48,15 +48,15 @@ function multi_block_cgb_editor_assets() {
4848
'multi_block-cgb-block-js', // Handle.
4949
plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack.
5050
array( 'wp-blocks', 'wp-i18n', 'wp-element' ) // Dependencies, defined above.
51-
// filemtime( plugin_dir_path( __FILE__ ) . 'block.js' ) // Version: filemtime β€” Gets file modification time.
51+
// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.build.js' ) // Version: filemtime β€” Gets file modification time.
5252
);
5353

5454
// Styles.
5555
wp_enqueue_style(
5656
'multi_block-cgb-block-editor-css', // Handle.
5757
plugins_url( 'dist/blocks.editor.build.css', dirname( __FILE__ ) ), // Block editor CSS.
5858
array( 'wp-edit-blocks' ) // Dependency to include the CSS after it.
59-
// filemtime( plugin_dir_path( __FILE__ ) . 'editor.css' ) // Version: filemtime β€” Gets file modification time.
59+
// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.editor.build.css' ) // Version: filemtime β€” Gets file modification time.
6060
);
6161
} // End function multi_block_cgb_editor_assets().
6262

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function multi_block_cgb_block_assets() {
2626
'multi_block-cgb-style-css', // Handle.
2727
plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), // Block style CSS.
2828
array( 'wp-blocks' ) // Dependency to include the CSS after it.
29-
// filemtime( plugin_dir_path( __FILE__ ) . 'editor.css' ) // Version: filemtime β€” Gets file modification time.
29+
// 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().
3232

@@ -48,15 +48,15 @@ function multi_block_cgb_editor_assets() {
4848
'multi_block-cgb-block-js', // Handle.
4949
plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack.
5050
array( 'wp-blocks', 'wp-i18n', 'wp-element' ) // Dependencies, defined above.
51-
// filemtime( plugin_dir_path( __FILE__ ) . 'block.js' ) // Version: filemtime β€” Gets file modification time.
51+
// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.build.js' ) // Version: filemtime β€” Gets file modification time.
5252
);
5353

5454
// Styles.
5555
wp_enqueue_style(
5656
'multi_block-cgb-block-editor-css', // Handle.
5757
plugins_url( 'dist/blocks.editor.build.css', dirname( __FILE__ ) ), // Block editor CSS.
5858
array( 'wp-edit-blocks' ) // Dependency to include the CSS after it.
59-
// filemtime( plugin_dir_path( __FILE__ ) . 'editor.css' ) // Version: filemtime β€” Gets file modification time.
59+
// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.editor.build.css' ) // Version: filemtime β€” Gets file modification time.
6060
);
6161
} // End function multi_block_cgb_editor_assets().
6262

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Enqueue CSS/JS of all the blocks.
66
*
7-
* @since 1.0.0
7+
* @since 1.0.0
88
* @package CGB
99
*/
1010

@@ -26,7 +26,7 @@ function <% blockNamePHPLower %>_cgb_block_assets() {
2626
'<% blockNamePHPLower %>-cgb-style-css', // Handle.
2727
plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), // Block style CSS.
2828
array( 'wp-blocks' ) // Dependency to include the CSS after it.
29-
// filemtime( plugin_dir_path( __FILE__ ) . 'editor.css' ) // Version: filemtime β€” Gets file modification time.
29+
// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: filemtime β€” Gets file modification time.
3030
);
3131
} // End function <% blockNamePHPLower %>_cgb_block_assets().
3232

@@ -47,18 +47,19 @@ function <% blockNamePHPLower %>_cgb_editor_assets() {
4747
wp_enqueue_script(
4848
'<% blockNamePHPLower %>-cgb-block-js', // Handle.
4949
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-
// filemtime( plugin_dir_path( __FILE__ ) . 'block.js' ) // Version: filemtime β€” Gets file modification time.
50+
array( 'wp-blocks', 'wp-i18n', 'wp-element' ), // Dependencies, defined above.
51+
// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.build.js' ), // Version: filemtime β€” Gets file modification time.
52+
true // Enqueue the script in the footer.
5253
);
5354

5455
// Styles.
5556
wp_enqueue_style(
5657
'<% blockNamePHPLower %>-cgb-block-editor-css', // Handle.
5758
plugins_url( 'dist/blocks.editor.build.css', dirname( __FILE__ ) ), // Block editor CSS.
5859
array( 'wp-edit-blocks' ) // Dependency to include the CSS after it.
59-
// filemtime( plugin_dir_path( __FILE__ ) . 'editor.css' ) // Version: filemtime β€” Gets file modification time.
60+
// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.editor.build.css' ) // Version: filemtime β€” Gets file modification time.
6061
);
6162
} // End function <% blockNamePHPLower %>_cgb_editor_assets().
6263

6364
// Hook: Editor assets.
64-
add_action( 'enqueue_block_editor_assets', '<% blockNamePHPLower %>_cgb_editor_assets' );
65+
add_action( 'enqueue_block_editor_assets', '<% blockNamePHPLower %>_cgb_editor_assets' );

0 commit comments

Comments
Β (0)