Gutenberg comes with a set of core libraries which are necessary for any kind of custom block development. Namely those libraries are: @wordpress/components: Generic, reusable UI WordPress components @wordpress/i18n: Internationalization utilities @wordpress/element: Abstraction on top of React @wordpress/date: Date formatting and manipulation utilities @wordpress/blocks: Module providing utilities for registering and building blocks @wordpress/data: Abstraction on top of Redux @wordpress/editor: Module representing the WordPress Editor’s page @wordpress/utils: Various generic utilities To use them you need to include them as external script requirements to your final build by registering and enqueueing them, similarly to how you’d include any kind of script or style within WordPress. function my_plugin_enqueue_editor_assets() { wp_enqueue_script( 'myplugin', untrailingslashit( MY_PLUGIN_DIR_URL ) . '/build/', array( 'wp-components', 'wp-blocks', 'wp-element', 'wp-data', 'wp-date', 'wp-utils', 'wp-i18n', ), MY_PLUGIN_VERSION ); } add_action( 'enqueue_block_assets', 'my_plugin_enqueue_editor_assets' ); The above then will be loaded as separate
Share This

We are using cookies on our website

Please confirm, if you accept our tracking cookies. You can also decline the tracking, so you can continue to visit our website without any data sent to third party services.