Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block library: Try to use Babel plugins to inline block.json metadata #14551

Merged
merged 3 commits into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Address feedback from code review
  • Loading branch information
gziolo committed Apr 1, 2019
commit 98786ad3c902384251b21f74f63b2784aaff3647
2 changes: 1 addition & 1 deletion packages/block-library/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export const registerCoreBlocks = () => {
if ( ! block ) {
return;
}
const { metadata, settings, name = metadata.name } = block;
const { metadata, settings, name } = block;
if ( metadata ) {
unstable__bootstrapServerSideBlockDefinitions( { [ name ]: metadata } ); // eslint-disable-line camelcase
}
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/text-columns/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"source": "html"
}
},
"default": [ { }, { } ]
"default": [ {}, {} ]
},
"columns": {
"type": "number",
Expand Down
4 changes: 3 additions & 1 deletion packages/block-library/src/text-columns/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ import deprecated from '@wordpress/deprecated';
*/
import metadata from './block.json';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It gets transpiled into:

Screen Shot 2019-03-21 at 16 47 22


export { metadata };
const { name } = metadata;

export { metadata, name };

export const settings = {
// Disable insertion as this block is deprecated and ultimately replaced by the Columns block.
Expand Down