plugin_dir_path( __DIR__ ), 'pluginDirUrl' => plugin_dir_url( __DIR__ ), // Add more data here that you want to access from `cgbGlobal` object. ] ); /** * Register Gutenberg block on server-side. * * Register the block on server-side to ensure that the block * scripts and styles for both frontend and backend are * enqueued when the editor loads. * * @link https://wordpress.org/gutenberg/handbook/blocks/writing-your-first-block-type#enqueuing-block-scripts * @since 1.16.0 */ register_block_type( 'cgb/block-cognito', array( // Enqueue blocks.style.build.css on both frontend & backend. 'style' => 'cognito-cgb-style-css', // Enqueue blocks.build.js in the editor only. 'editor_script' => 'cognito-cgb-block-js', // Enqueue blocks.editor.build.css in the editor only. 'editor_style' => 'cognito-cgb-block-editor-css', ) ); } // Hook: Block assets. add_action( 'init', 'cognito_cgb_block_assets' );