Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrtashjian committed Mar 25, 2019
0 parents commit 3051f93
Show file tree
Hide file tree
Showing 11 changed files with 5,634 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .babelrc
@@ -0,0 +1,3 @@
{
"presets": [ "@babel/preset-env", "@babel/preset-react" ]
}
10 changes: 10 additions & 0 deletions .browserlistrc
@@ -0,0 +1,10 @@
> 1%
ie >= 11
last 1 Android versions
last 1 ChromeAndroid versions
last 2 Chrome versions
last 2 Firefox versions
last 2 Safari versions
last 2 iOS versions
last 2 Edge versions
last 2 Opera versions
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
.vscode
node_modules
1 change: 1 addition & 0 deletions block.build.js

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

14 changes: 14 additions & 0 deletions block.js
@@ -0,0 +1,14 @@
const { registerBlockType } = wp.blocks;

registerBlockType('gwg/esnext-starter', {
title: 'Get With Gutenberg - ESNext Starter',
category: 'common',

edit(props) {
return <p className={props.className}>Hello editor.</p>;
},

save(props) {
return <p className={props.className}>Hello saved content.</p>;
},
});
4 changes: 4 additions & 0 deletions editor.css
@@ -0,0 +1,4 @@

.wp-block-gwg-esnext-starter {
background-color: green;
}
47 changes: 47 additions & 0 deletions index.php
@@ -0,0 +1,47 @@
<?php
/**
* Plugin Name: ESNext Starter - Get With Gutenberg
* Plugin URI: https://github.com/Wordpress
* Description: Demonstrate how to start building a Gutenberg block in ESNext.
* Version: 1.0.0
* Author: Get With Gutenberg
* Author URI: https://getwithgutenberg.com
* Text Domain: gwg
* Domain Path: languages
* License: GPL2+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/

defined( 'ABSPATH' ) || exit;

define( 'GWG_ESNEXT_VERSION', '1.0.0' );
define( 'GWG_ESNEXT_PLUGIN_DIR', dirname( __FILE__ ) );
define( 'GWG_ESNEXT_PLUGIN_URL', plugin_dir_url( __FILE__ ) );

function gwg_block_assets() {
wp_enqueue_style(
'gwg-style-css',
GWG_ESNEXT_PLUGIN_URL . 'style.css',
[],
GWG_ESNEXT_VERSION
);
}
add_action( 'enqueue_block_assets', 'gwg_block_assets' );

function gwg_editor_assets() {
wp_enqueue_script(
'gwg-block-js',
GWG_ESNEXT_PLUGIN_URL . 'block.build.js',
[],
GWG_ESNEXT_VERSION,
true // Enqueue script in the footer.
);

wp_enqueue_style(
'gwg-editor-css',
GWG_ESNEXT_PLUGIN_URL . 'editor.css',
[],
GWG_ESNEXT_VERSION
);
}
add_action( 'enqueue_block_editor_assets', 'gwg_editor_assets' );

0 comments on commit 3051f93

Please sign in to comment.