Skip to content
Permalink
Browse files

Add the minimal code to start building BuddyPress blocks

Add 2 example blocks so that it is easy to understand how to add new ones.
Create a BP_Block class to simplify scripts and styles registration.
Only load blocks when corresponding components are active.
Set the run/build process using Parcel Bundler.
Add a WordPress code formatting script to check it.
  • Loading branch information
imath committed Nov 10, 2019
1 parent 9e0e830 commit 227a15814cfbf239fb382ee5b11d29240a6ae54f
@@ -0,0 +1,3 @@
{
"presets": ["@wordpress/default"]
}
@@ -0,0 +1,24 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[*.yml]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[{*.txt}]
end_of_line = crlf
@@ -0,0 +1,14 @@
# Operating system specific files
.DS_Store
.DS_*
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Files and folders related to build/test tools
node_modules
npm-debug.log
vendor
.cache
@@ -0,0 +1,29 @@
<?php
/**
* BP Groups Blocks Functions.
*
* @package bp-blocks
* @subpackage \inc\bp-groups\bp-groups-blocks
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Register Groups Blocks.
*
* @since 6.0.0
*/
function bp_groups_register_blocks() {
bp_register_block(
array(
'name' => 'bp/group',
'editor_script' => 'bp-group-block',
'editor_script_url' => plugins_url( 'js/blocks/group.js', __FILE__ ),
'editor_script_deps' => array( 'wp-blocks', 'wp-element' ),
)
);
}
add_action( 'bp_blocks_init', 'bp_groups_register_blocks', 10 );
@@ -0,0 +1 @@
/* CSS for the bp/group block */

0 comments on commit 227a158

Please sign in to comment.
You can’t perform that action at this time.