Create custom blocks for bootstrap

Question

I’m reading the tutorial on how to create blocks for the Gutemberg editor.
I want to implemente the bootstrap 4 grid, but I’m a bit confused on how to proceed. Can anyone explain to me what’s the correct way to do this?
I suppose that I need to register the bootstrap css and js files, usually I integrate them inside my custom themes so I’m not sure how to proceed with this part. Also I’m confused on the blocks type. May I need to register a single block for each column size and for row and containers offered by bootstrap?
An example will be appreciated.

for now in my plugin file I have only few lines of code:

<?php
/**
 * Plugin Name: BlockStrap
 * Version: 1.0
 */

class BlockStrap {

  public function __construct()
  {
    add_action( 'enqueue_block_editor_assets', [$this, 'init'] );
  }

  public function init()
  {
    wp_enqueue_script(
      'bootstrap-blocks',
      plugins_url( 'main.js', __FILE__ ),
      ['wp-blocks']
    );
  }

}

new BlockStrap;

?>

0
, , , sialfa 2 years 2019-12-03T09:55:54-05:00 0 Answers 108 views 0

Leave an answer

Browse
Browse