Skip to content

Commit

Permalink
Merge pull request #4 from a8cteam51/example-static
Browse files Browse the repository at this point in the history
Adding example block
  • Loading branch information
tommusrhodus authored Mar 23, 2024
2 parents da61efa + 3bef691 commit bbcc4ca
Show file tree
Hide file tree
Showing 20 changed files with 18,973 additions and 0 deletions.
18 changes: 18 additions & 0 deletions example-static/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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,yaml}]
indent_style = space
indent_size = 2
30 changes: 30 additions & 0 deletions example-static/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Coverage directory used by tools like istanbul
coverage

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Output of `npm pack`
*.tgz

# Output of `wp-scripts plugin-zip`
*.zip

# dotenv environment variables file
.env
19 changes: 19 additions & 0 deletions example-static/build/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "create-block/example-static",
"version": "0.1.0",
"title": "Example Static",
"category": "widgets",
"icon": "smiley",
"description": "Example block scaffolded with Create Block tool.",
"example": {},
"supports": {
"html": false
},
"textdomain": "example-static",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",
"viewScript": "file:./view.js"
}
1 change: 1 addition & 0 deletions example-static/build/index.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-i18n'), 'version' => '4b2e552357d478849de4');
1 change: 1 addition & 0 deletions example-static/build/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.wp-block-create-block-example-static{border:1px dotted red}
1 change: 1 addition & 0 deletions example-static/build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions example-static/build/style-index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.wp-block-create-block-example-static{background-color:#21759b;color:#fff;padding:2px}
1 change: 1 addition & 0 deletions example-static/build/view.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array(), 'version' => '4e8fa598c155f4889a33');
1 change: 1 addition & 0 deletions example-static/build/view.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("Hello World! (from create-block-example-static block)");
30 changes: 30 additions & 0 deletions example-static/example-static.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/**
* Plugin Name: Example Static
* Description: Example block scaffolded with Create Block tool.
* Requires at least: 6.1
* Requires PHP: 7.0
* Version: 0.1.0
* Author: The WordPress Contributors
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: example-static
*
* @package create-block
*/

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}

/**
* Registers the block using the metadata loaded from the `block.json` file.
* Behind the scenes, it registers also all assets so they can be enqueued
* through the block editor in the corresponding context.
*
* @see https://developer.wordpress.org/reference/functions/register_block_type/
*/
function example_static_example_static_block_init() {
register_block_type( __DIR__ . '/build' );
}
add_action( 'init', 'example_static_example_static_block_init' );
Loading

0 comments on commit bbcc4ca

Please sign in to comment.