Skip to content

Commit

Permalink
Gutenblocks: Revert move to JP (#11682)
Browse files Browse the repository at this point in the history
* Revert "Add source for Gutenberg extensions (#11633)"

This reverts commit a2bf967.

* Revert "Build: Prepare tooling for Gutenberg extensions in Jetpack (#11639)"

This reverts commit 0d14622.
  • Loading branch information
kraftbj authored Mar 26, 2019
1 parent 1320ca5 commit 9deff5e
Show file tree
Hide file tree
Showing 226 changed files with 150 additions and 15,391 deletions.
13 changes: 0 additions & 13 deletions .svnignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,3 @@ yarn.lock
docker
bin/pre-commit-hook.js
yarn-error.log
extensions/**/*.css
extensions/**/*.gif
extensions/**/*.jpeg
extensions/**/*.jpg
extensions/**/*.js
extensions/**/*.json
extensions/**/*.jsx
extensions/**/*.md
extensions/**/*.png
extensions/**/*.sass
extensions/**/*.scss
extensions/**/*.svg
**/__snapshots__
42 changes: 7 additions & 35 deletions bin/build-asset-cdn-json.php
Original file line number Diff line number Diff line change
@@ -1,48 +1,20 @@
<?php

// The repo root path.
$path = dirname( dirname( __FILE__ ) ) . '/';

// Build an iterator over all files in the repo that match the regex in the RegexIterator.
$path = dirname( dirname( __FILE__ ) ) . '/';
$directory = new RecursiveDirectoryIterator( $path );
$iterator = new RecursiveIteratorIterator( $directory );
$regex = new RegexIterator( $iterator, '/^.+\.(css|js)$/i', RecursiveRegexIterator::GET_MATCH );

$ignore_paths = array(
'_inc/client/',
'bin/',
'docker/',
'docs/',
'extensions/',
'logs/',
'node_modules/',
'tests/',
'tools/',
'vendor/',
);

$manifest = array();
foreach ( $regex as $path_to_file => $value ) {
$path_from_repo_root = str_replace( $path, '', $path_to_file );

// Ignore top-level files.
if ( false === strpos( $path_from_repo_root, '/' ) ) {
foreach ( $regex as $file => $value ) {
$file = str_replace( $path, '', $file );
$directory = substr( $file, 0, strpos( $file, '/' ) );
if ( in_array( $directory, array( 'node_modules', 'tests' ) ) ) {
continue;
}

// Ignore explicit ignore list.
foreach ( $ignore_paths as $ignore_path ) {
if ( 0 === strpos( $path_from_repo_root, $ignore_path ) ) {
continue 2;
}
}

$manifest[] = $path_from_repo_root;
$manifest[] = $file;
}

$export = var_export( $manifest, true );

file_put_contents( $path . 'modules/photon-cdn/jetpack-manifest.php', "<?php
// This file is autogenerated by bin/build-asset-cdn-json.php
\$assets = $export;\r\n" );
file_put_contents( $path . 'modules/photon-cdn/jetpack-manifest.php', "<?php \r\n\$assets = $export;\r\n" );
1 change: 0 additions & 1 deletion class.jetpack-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,6 @@ public static function enqueue_block_editor_assets() {
'wp-edit-post',
'wp-editor',
'wp-element',
'wp-escape-html',
'wp-hooks',
'wp-i18n',
'wp-keycodes',
Expand Down
28 changes: 15 additions & 13 deletions extensions/README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
# Jetpack Block Editor Extensions

This directory lists extensions for the Block Editor, also known as Gutenberg,
[that was introduced in WordPress 5.0](https://wordpress.org/news/2018/12/bebo/).
This directory lists extensions for the Block Editor, also known as Gutenberg, [that was introduced in WordPress 5.0](https://wordpress.org/news/2018/12/bebo/).

## Extension Type

We define different types of block editor extensions:

- Blocks are available in the editor itself.
- Plugins are available in the Jetpack sidebar that appears on the right side of the block editor.
- Blocks are available in the editor itself, and live in the `blocks` directory.
- Plugins are available in the Jetpack sidebar that appears on the right side of the block editor. Those live in the `plugins` directory.

When adding a new extension, add a new directory for your extension the matching directory.

## Extension Structure

Extensions loosely follow this structure:
Your extension should follow this structure:

```
.
└── block-or-plugin-name/
├── block-or-plugin-name.php ← PHP file where the block and its assets are registered.
├── editor.js ← script loaded only in the editor
├── editor.scss ← styles loaded only in the editor
├── view.js ← script loaded in the editor and theme
└── view.scss ← styles loaded in the editor and theme
└── blockname/
└── blockname.php ← PHP file where the block and its assets are registered.
```

If your block depends on another block, place them all in extensions folder:

```
.
├── block-name/
├── blockname/
└── sub-blockname/
```

**Note that this directory is still being populated. For now, you can find the blocks [here](https://github.com/Automattic/wp-calypso/tree/master/client/gutenberg/extensions).

## Develop new blocks

Coming when [#11640](https://github.com/Automattic/jetpack/pull/11640) lands.
You can follow [the instructions here](../docs/guides/gutenberg-blocks.md) to add your own block to Jetpack.

## Block naming conventions

Blocks should use the `jetpack/` prefix, e.g. `jetpack/markdown`.
200 changes: 0 additions & 200 deletions extensions/blocks/business-hours/components/day-edit.js

This file was deleted.

58 changes: 0 additions & 58 deletions extensions/blocks/business-hours/components/day-preview.js

This file was deleted.

Loading

0 comments on commit 9deff5e

Please sign in to comment.