-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Docs: Fundamentals of Block Development - File structure of a block #56551
Docs: Fundamentals of Block Development - File structure of a block #56551
Conversation
@fabiankaegy as you approved #56316, can you have a look at this PR and approve it if everything remains OK? I'll merge it once I get the proper approvals without adding it to the sidebar. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a couple of notes that are probably not critical so feel free to merge if you disagree.
docs/getting-started/fundamentals-block-development/file-structure-of-a-block.md
Outdated
Show resolved
Hide resolved
|
||
### `save.js` | ||
|
||
The `save.js` is similar to the `edit.js` file in that it exports a single React component. This component generates the static HTML markup that gets saved to the Database. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
save
is a standard JavaScript function. It can be created as a component but under the hood only the render method is called as a JS function. Looking at scaffolded files, you'll notice that save
is lowercase and React components are written in uppercase.
This may be pedantic but it's worth mentioning.
…ture-of-a-block.md Co-authored-by: Ryan Welcher <[email protected]>
@@ -0,0 +1,88 @@ | |||
# File structure of a block | |||
|
|||
The most common way to register a custom block is via a JSON file that contains all of the metadata of the block. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line feels out of place. I am not sure how it directly relates to the file structure. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. It's not clear the value of this message here.
I'll remove it.
…k-2' of github.com:WordPress/gutenberg into fundamentals-block-development/file-structure-of-a-block-2
…56551) * Add file structure documentation for custom blocks * Update docs/getting-started/fundamentals-block-development/file-structure-of-a-block.md Co-authored-by: Ryan Welcher <[email protected]> * Removed not clear sentence --------- Co-authored-by: Ryan Welcher <[email protected]>
Note
I opened this new PR to avoid some unwanted commits I got on the original one #56316 when trying to get that branch rebased from trunk
Add documentation for file structure of a block
This PR closes the issue #55437