Conversation
| * @param {Object} props The block props | ||
| * @return {Function} Render the edit screen | ||
| */ | ||
| const ExampleBockEdit = (props) => { |
There was a problem hiding this comment.
@ryanwelcher forgive me for this one - I'm not sure if our linting even supports it but for a single parameter, functions don't require parentheses.
There was a problem hiding this comment.
ah good catch! VSCode should be formatting on save for me. Wonder if that rule is not being run?
| /** | ||
| * Internal dependencies | ||
| */ | ||
| import edit from './edit'; |
There was a problem hiding this comment.
@ryanwelcher would it be cleaner to maybe organise the folder so that we could export out something like: import { edit, save, json } from './folder'
|
@ryanwelcher just a couple of things that we've been encountering on projects lately:
Everything else looks really great - glad you're paying this some attention! |
|
I also took a look at the PR and it looks very solid to me 👍 This will result in a much better workflow when working with block in themes. |
|
@dainemawer thanks for the feedback!
This makes a lot of sense. My concern with adding it in was that we quickly get into a lot of code/boilerplate that may or may not be useful on all projects. The concept behind registering the blocks in a single place on the PHP side does lend it self to an allow/deny list very easily via a a custom php filters - but again not necessarily on every project. As an aside, there is an internal block-library plugin being worked on that will provide a set of blocks as well as a way to add more blocks on a per-project basis. I would be concerned that having an API here as well as in that plugin would be more confusing than helpful/
This is potentially a larger conversation, I don't think the "10up way" should be to use ServerSideRender to render the block in the edit state unless there is a reason for doing so - such as needing the latest data from the server. The majority of the time, a block can leverage the markup structure from the PHP side with the addition of RichText fields to allow inline editing and keep the inputs out of the Block Inspector panel. The same CSS can be used in both the editor and the front end and the user gets a much more integrated experience that doesn't require PHP renders for every change. |
Thanks for this insight @ryanwelcher - and thanks for listening to my opinions. Looking forward to this being merged in. |
…. Using 5.5 new partial args
config/webpack.settings.js
Outdated
| 'styleguide-style': './assets/css/styleguide/styleguide.css', | ||
|
|
||
| // Blocks | ||
| 'example-block': './includes/blocks/example-block/register.js', |
There was a problem hiding this comment.
@ryanwelcher Would all custom blocks have it's own entry point?
There was a problem hiding this comment.
@samikeijonen yes. Technically, each block could have the same JS File as the enqueue process would only add it once but each block has it's own assets.
…-structure__jr Feature/203 gutenberg block structure
…up/theme-scaffold into feature/203-gutenberg-block-structure
|
I've added some notes/changes from @jaredrethman and some further tweaks. I'd love another set of 👀 on it if possible. I have an internal project that needs to adhere to how we create blocks in the scaffolds, so I'd like to get this ironed out soonish if possible. |
joesnellpdx
left a comment
There was a problem hiding this comment.
I left a few comments. I may be dense as I'm certainly not the Gutenberg expert - so please push back if any of my comments / suggestions are off base.
My overarching concerns:
- Consistency across our tooling and guidance for blocks (training, block library, scaffolding)
- "Easy" (relatively) to follow patterns
- Not adding unnecessary bloat, render blocking scripts, etc to the output that will negatively impact performance (especially on the front end - although we've been seeing issues in the admin on super complex block setups)
Besides the above and my other comments, the setup works for me and I have no issues.
Please add a time on my calendar if would make more sense to discuss!
|
@joesnellpdx changes based on our call have been pushed. |
There was a problem hiding this comment.
After discussing my concerns with @ryanwelcher, hopping on a call and making a few tweaks - I support these updates with the following caveats.
- @tlovett1 review the updates to the webpack.settings.js and webpack.config.common.js - in reference to the ~10upScripts that are in motion
- A small blog post is sent out at the time of this release so folks don't get caught off guard.
Description of the Change
This the implementation of the changes outline in #203
Benefits
A defined way of handling blocks in a theme.
Possible Drawbacks
This is big change to the build process.
Checklist:
Applicable Issues
#203
Changelog Entry