I use following code to register my Gutenberg Block:
register_block_type('create-block/myblock', array(
'editor_script' => 'create-block-myblock-script-editor',
'script' => 'create-block-myblock-script',
'editor_style' => 'create-block-myblock-style-editor',
'style' => 'create-block-myblock-style-1',
));
// register scripts & styles
wp_register_script('create-block-myblock-script-editor', $urlScriptEditor, array());
wp_register_script('create-block-myblock-script', $urlScript, array());
wp_register_style('create-block-myblock-style-editor', $urlEditor, array());
wp_register_style('create-block-myblock-style-1', $urlOne, array());
Now I want to register a second stylesheet for the front-end:
wp_register_style('create-block-myblock-style-2', $urlTwo, array());
How can I hook into the block register as only one script is intended for each case?
I use following code to register my Gutenberg Block:
register_block_type('create-block/myblock', array(
'editor_script' => 'create-block-myblock-script-editor',
'script' => 'create-block-myblock-script',
'editor_style' => 'create-block-myblock-style-editor',
'style' => 'create-block-myblock-style-1',
));
// register scripts & styles
wp_register_script('create-block-myblock-script-editor', $urlScriptEditor, array());
wp_register_script('create-block-myblock-script', $urlScript, array());
wp_register_style('create-block-myblock-style-editor', $urlEditor, array());
wp_register_style('create-block-myblock-style-1', $urlOne, array());
Now I want to register a second stylesheet for the front-end:
wp_register_style('create-block-myblock-style-2', $urlTwo, array());
How can I hook into the block register as only one script is intended for each case?
Not supported yet, see the corresponding Github Issue. I found a workaround in order to at least register additional block styles:
register_block_style(
'create-block/myblock', array(
'name' => 'style2',
'label' => 'Style 2',
'style_handle' => 'create-block-myblock-style-2',
)
);