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

[#129] Auto Create Blocks #134

Merged
merged 7 commits into from
Jul 30, 2024
Merged

Conversation

nathan-schmidt-viget
Copy link
Contributor

Summary

This adds plop which allows us to auto build block files from the templates. We ask several questions and then build all the files.

Issues

Testing Instructions

  1. Restart DDEV by running ddev restart
  2. Then path into the theme wp-content/themes/wp-starter
  3. Run ddev npm run plop block or ddev npm run plop - running without block plop will default to the first generator which is block.

Screenshots

Jul-24-2024 15-15-48

@nathan-schmidt-viget nathan-schmidt-viget force-pushed the ns/129-auto-create-blocks branch from b29f78b to 2fc6f09 Compare July 24, 2024 21:22
@nathan-schmidt-viget nathan-schmidt-viget marked this pull request as ready for review July 25, 2024 19:27
@nathan-schmidt-viget
Copy link
Contributor Author

We may need to adjust/update this as we update our WP Site Starter blocks, but this is a start.

Copy link
Contributor

@ten1seven ten1seven left a comment

Choose a reason for hiding this comment

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

Cool! I hadn't heard about plop before.

Copy link
Contributor

@bd-viget bd-viget left a comment

Choose a reason for hiding this comment

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

I think this is really cool and has a lot of potential to make Site Starter actions a lot easier to do!! Good find with Plop! I'd love to explore other ways we can use it too!

One thing I didn't mention in my comments, but wanted to bring up is that I'd like to try to move away from loading a pattern default as innerBlocks and use the block templating, it just seems to work better in more situations, even though it's more difficult to create. Maybe something to discuss later.

In order build a new block run:

```
ddev npm run plop block
Copy link
Contributor

Choose a reason for hiding this comment

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

One thing that would be cool would be to set up a simple custom command in ddev like ddev create-block that can be run anywhere in the project, that automatically executes from the theme directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, that would be nice. I will look into that.

@nathan-schmidt-viget
Copy link
Contributor Author

@bd-viget I am going to update the inner blocks part in my block refactor PR.

@nathan-schmidt-viget nathan-schmidt-viget merged commit dadbe3c into main Jul 30, 2024
@nathan-schmidt-viget nathan-schmidt-viget deleted the ns/129-auto-create-blocks branch July 30, 2024 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants